@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,177 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.feed-container {
|
|
6
|
+
border-radius: var(--radius);
|
|
7
|
+
border: 1px solid var(--border);
|
|
8
|
+
background: var(--card);
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.feed-header {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: space-between;
|
|
16
|
+
padding: 0.75rem 1rem;
|
|
17
|
+
border-bottom: 1px solid var(--border);
|
|
18
|
+
background: rgba(26, 31, 46, 0.5);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.header-left {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
gap: 0.5rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.live-dot {
|
|
28
|
+
position: relative;
|
|
29
|
+
width: 8px;
|
|
30
|
+
height: 8px;
|
|
31
|
+
background: #00d26a;
|
|
32
|
+
border-radius: 50%;
|
|
33
|
+
|
|
34
|
+
&::before {
|
|
35
|
+
content: '';
|
|
36
|
+
position: absolute;
|
|
37
|
+
inset: 0;
|
|
38
|
+
border-radius: 50%;
|
|
39
|
+
background: #00d26a;
|
|
40
|
+
animation: ping 1.5s ease-out infinite;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@keyframes ping {
|
|
45
|
+
0% {
|
|
46
|
+
transform: scale(1);
|
|
47
|
+
opacity: 1;
|
|
48
|
+
}
|
|
49
|
+
100% {
|
|
50
|
+
transform: scale(2.5);
|
|
51
|
+
opacity: 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.header-title {
|
|
56
|
+
font-size: 0.875rem;
|
|
57
|
+
font-weight: 600;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.event-count {
|
|
61
|
+
font-size: 0.65rem;
|
|
62
|
+
padding: 2px 8px;
|
|
63
|
+
border-radius: 4px;
|
|
64
|
+
border: 1px solid var(--border);
|
|
65
|
+
color: var(--muted-foreground);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.feed-body {
|
|
69
|
+
max-height: 400px;
|
|
70
|
+
overflow-y: auto;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.activity-item {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: flex-start;
|
|
76
|
+
gap: 0.75rem;
|
|
77
|
+
padding: 0.75rem 1rem;
|
|
78
|
+
border-bottom: 1px solid rgba(42, 47, 66, 0.5);
|
|
79
|
+
transition: background 0.2s ease;
|
|
80
|
+
animation: slide-in 0.3s ease-out forwards;
|
|
81
|
+
opacity: 0;
|
|
82
|
+
|
|
83
|
+
&:hover {
|
|
84
|
+
background: rgba(26, 31, 46, 0.3);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&:last-child {
|
|
88
|
+
border-bottom: none;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@keyframes slide-in {
|
|
93
|
+
from {
|
|
94
|
+
opacity: 0;
|
|
95
|
+
transform: translateY(-5px);
|
|
96
|
+
}
|
|
97
|
+
to {
|
|
98
|
+
opacity: 1;
|
|
99
|
+
transform: translateY(0);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.activity-content {
|
|
104
|
+
flex: 1;
|
|
105
|
+
min-width: 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.activity-header {
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
gap: 0.5rem;
|
|
112
|
+
flex-wrap: wrap;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.player-name {
|
|
116
|
+
font-size: 0.875rem;
|
|
117
|
+
font-weight: 600;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.activity-badge {
|
|
121
|
+
display: inline-flex;
|
|
122
|
+
align-items: center;
|
|
123
|
+
gap: 0.25rem;
|
|
124
|
+
font-size: 0.6rem;
|
|
125
|
+
padding: 2px 6px;
|
|
126
|
+
border-radius: 4px;
|
|
127
|
+
border: 1px solid;
|
|
128
|
+
font-weight: 600;
|
|
129
|
+
text-transform: uppercase;
|
|
130
|
+
|
|
131
|
+
&.win {
|
|
132
|
+
background: rgba(0, 210, 106, 0.2);
|
|
133
|
+
border-color: rgba(0, 210, 106, 0.3);
|
|
134
|
+
color: #00d26a;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&.jackpot {
|
|
138
|
+
background: rgba(255, 215, 0, 0.2);
|
|
139
|
+
border-color: rgba(255, 215, 0, 0.3);
|
|
140
|
+
color: var(--gold);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&.streak {
|
|
144
|
+
background: rgba(255, 165, 2, 0.2);
|
|
145
|
+
border-color: rgba(255, 165, 2, 0.3);
|
|
146
|
+
color: #ffa502;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&.achievement {
|
|
150
|
+
background: rgba(0, 212, 255, 0.2);
|
|
151
|
+
border-color: rgba(0, 212, 255, 0.3);
|
|
152
|
+
color: var(--primary);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.activity-message {
|
|
157
|
+
font-size: 0.875rem;
|
|
158
|
+
color: var(--muted-foreground);
|
|
159
|
+
margin-top: 0.25rem;
|
|
160
|
+
white-space: nowrap;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
text-overflow: ellipsis;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.activity-amount {
|
|
166
|
+
font-family: var(--font-mono);
|
|
167
|
+
font-weight: 700;
|
|
168
|
+
color: #00d26a;
|
|
169
|
+
font-size: 0.875rem;
|
|
170
|
+
margin-top: 0.25rem;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.activity-time {
|
|
174
|
+
font-size: 0.65rem;
|
|
175
|
+
color: var(--muted-foreground);
|
|
176
|
+
white-space: nowrap;
|
|
177
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { DEFAULT_LIVE_FEED_TITLE, SF_LIVE_FEED_TAG } from '../../constants.js';
|
|
4
|
+
import { sfLiveFeedTheme } from '../../styles/theme.js';
|
|
5
|
+
import type { LiveFeedActivity } from '../../types.js';
|
|
6
|
+
import { formatCurrency, formatTime } from '../../utils.js';
|
|
7
|
+
import '../avatar/avatar.js';
|
|
8
|
+
import type { SfLiveFeedHost } from './sf-live-feed.host.js';
|
|
9
|
+
import renderTemplate from './sf-live-feed.html?lit-html';
|
|
10
|
+
import styles from './sf-live-feed.scss?inline';
|
|
11
|
+
import { scss } from '../../../../lib/lit/scss.js';
|
|
12
|
+
|
|
13
|
+
@customElement(SF_LIVE_FEED_TAG)
|
|
14
|
+
export class SfLiveFeed extends LitElement implements SfLiveFeedHost {
|
|
15
|
+
static styles = [sfLiveFeedTheme, scss(styles)];
|
|
16
|
+
|
|
17
|
+
@property({ type: Array }) activities: LiveFeedActivity[] = [];
|
|
18
|
+
@property({ type: String, attribute: 'feed-title' })
|
|
19
|
+
feedTitle = DEFAULT_LIVE_FEED_TITLE;
|
|
20
|
+
|
|
21
|
+
private getActivityBadge(type: LiveFeedActivity['type']) {
|
|
22
|
+
const badges = {
|
|
23
|
+
win: { label: 'WIN', icon: '💵' },
|
|
24
|
+
jackpot: { label: 'JACKPOT', icon: '⚡' },
|
|
25
|
+
streak: { label: 'STREAK', icon: '🔥' },
|
|
26
|
+
achievement: { label: 'ACHIEVEMENT', icon: '🏆' },
|
|
27
|
+
};
|
|
28
|
+
return badges[type];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
renderActivityAmount(amount?: number) {
|
|
32
|
+
return amount
|
|
33
|
+
? html`<p class="activity-amount">+${formatCurrency(amount)}</p>`
|
|
34
|
+
: html``;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
renderActivities() {
|
|
38
|
+
return html`${this.activities.map((activity, index) => {
|
|
39
|
+
const badge = this.getActivityBadge(activity.type);
|
|
40
|
+
return html`
|
|
41
|
+
<div class="activity-item" style="animation-delay: ${index * 100}ms">
|
|
42
|
+
<sf-live-feed-avatar
|
|
43
|
+
username="${activity.player.username}"
|
|
44
|
+
avatar="${activity.player.avatar || ''}"
|
|
45
|
+
></sf-live-feed-avatar>
|
|
46
|
+
<div class="activity-content">
|
|
47
|
+
<div class="activity-header">
|
|
48
|
+
<span class="player-name">${activity.player.username}</span>
|
|
49
|
+
<span class="activity-badge ${activity.type}">
|
|
50
|
+
${badge.icon} ${badge.label}
|
|
51
|
+
</span>
|
|
52
|
+
</div>
|
|
53
|
+
<p class="activity-message">${activity.message}</p>
|
|
54
|
+
${this.renderActivityAmount(activity.amount)}
|
|
55
|
+
</div>
|
|
56
|
+
<span class="activity-time">${formatTime(activity.timestamp)}</span>
|
|
57
|
+
</div>
|
|
58
|
+
`;
|
|
59
|
+
})}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
render() {
|
|
63
|
+
return renderTemplate(this);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { LiveFeedActivity } from '../types.js';
|
|
2
|
+
|
|
3
|
+
export const mockLiveFeedActivities: LiveFeedActivity[] = [
|
|
4
|
+
{
|
|
5
|
+
id: '1',
|
|
6
|
+
type: 'jackpot',
|
|
7
|
+
player: { username: 'CryptoKing', avatar: '' },
|
|
8
|
+
message: 'Hit the MEGA JACKPOT on Lightning Slots!',
|
|
9
|
+
amount: 125000,
|
|
10
|
+
timestamp: new Date(Date.now() - 30000),
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: '2',
|
|
14
|
+
type: 'win',
|
|
15
|
+
player: { username: 'AceHunter', avatar: '' },
|
|
16
|
+
message: "Won a massive pot in Texas Hold'em",
|
|
17
|
+
amount: 45000,
|
|
18
|
+
timestamp: new Date(Date.now() - 120000),
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: '3',
|
|
22
|
+
type: 'streak',
|
|
23
|
+
player: { username: 'LuckyDragon', avatar: '' },
|
|
24
|
+
message: 'Reached a 8-game winning streak!',
|
|
25
|
+
timestamp: new Date(Date.now() - 300000),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: '4',
|
|
29
|
+
type: 'achievement',
|
|
30
|
+
player: { username: 'MoonShot', avatar: '' },
|
|
31
|
+
message: "Unlocked 'Rising Star' achievement",
|
|
32
|
+
timestamp: new Date(Date.now() - 600000),
|
|
33
|
+
},
|
|
34
|
+
];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live feed — public API.
|
|
3
|
+
* Import: `import '@skinforge/sf-live-feed'`
|
|
4
|
+
*/
|
|
5
|
+
export type {
|
|
6
|
+
LiveFeedActivity,
|
|
7
|
+
LiveFeedActivityType,
|
|
8
|
+
LiveFeedPlayerRef,
|
|
9
|
+
} from './types.js';
|
|
10
|
+
export {
|
|
11
|
+
SF_LIVE_FEED_TAG,
|
|
12
|
+
SF_LIVE_FEED_AVATAR_TAG,
|
|
13
|
+
DEFAULT_LIVE_FEED_TITLE,
|
|
14
|
+
} from './constants.js';
|
|
15
|
+
export { formatCurrency, formatTime, getInitials } from './utils.js';
|
|
16
|
+
export { SfLiveFeed } from './components/sf-live-feed/sf-live-feed.js';
|
|
17
|
+
export { SfLiveFeedAvatar } from './components/avatar/avatar.js';
|
|
18
|
+
|
|
19
|
+
import './components/sf-live-feed/sf-live-feed.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--background: #0a0c14;
|
|
3
|
+
--foreground: #f0f0f5;
|
|
4
|
+
--card: #12151f;
|
|
5
|
+
--primary: #00d4ff;
|
|
6
|
+
--muted-foreground: #808090;
|
|
7
|
+
--border: #2a2f42;
|
|
8
|
+
--gold: #ffd700;
|
|
9
|
+
--radius: 12px;
|
|
10
|
+
--font-sans: 'Inter', system-ui, sans-serif;
|
|
11
|
+
--font-mono: 'JetBrains Mono', monospace;
|
|
12
|
+
|
|
13
|
+
font-family: var(--font-sans);
|
|
14
|
+
color: var(--foreground);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
* {
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type LiveFeedActivityType =
|
|
2
|
+
| 'win'
|
|
3
|
+
| 'jackpot'
|
|
4
|
+
| 'streak'
|
|
5
|
+
| 'achievement';
|
|
6
|
+
|
|
7
|
+
export interface LiveFeedPlayerRef {
|
|
8
|
+
username: string;
|
|
9
|
+
avatar?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface LiveFeedActivity {
|
|
13
|
+
id: string;
|
|
14
|
+
type: LiveFeedActivityType;
|
|
15
|
+
player: LiveFeedPlayerRef;
|
|
16
|
+
message: string;
|
|
17
|
+
amount?: number;
|
|
18
|
+
timestamp: Date;
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function formatCurrency(amount: number): string {
|
|
2
|
+
if (amount >= 1_000_000) return `$${(amount / 1_000_000).toFixed(2)}M`;
|
|
3
|
+
if (amount >= 1_000) return `$${(amount / 1_000).toFixed(1)}K`;
|
|
4
|
+
return `$${amount.toFixed(2)}`;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function formatTime(date: Date): string {
|
|
8
|
+
const now = new Date();
|
|
9
|
+
const diff = Math.floor((now.getTime() - date.getTime()) / 1000);
|
|
10
|
+
if (diff < 60) return `${diff}s ago`;
|
|
11
|
+
if (diff < 3600) return `${Math.floor(diff / 60)}m ago`;
|
|
12
|
+
return `${Math.floor(diff / 3600)}h ago`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function getInitials(name: string): string {
|
|
16
|
+
return name.slice(0, 2).toUpperCase();
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StreaksStep } from './types.js';
|
|
2
|
+
|
|
3
|
+
/** Custom element tag registered by this feature. */
|
|
4
|
+
export const SF_STREAKS_TAG = 'sf-streaks';
|
|
5
|
+
|
|
6
|
+
export const DEFAULT_STREAKS_TITLE = 'Win up to $50,000!';
|
|
7
|
+
|
|
8
|
+
export const DEFAULT_STREAKS_SUBTITLE =
|
|
9
|
+
'Complete 5 tasks to unlock the Wheel and spin for rewards!';
|
|
10
|
+
|
|
11
|
+
export const DEFAULT_STREAKS_STEPS: StreaksStep[] = [
|
|
12
|
+
{ id: '1', label: 'G1', completed: true },
|
|
13
|
+
{ id: '2', label: 'G2', completed: true },
|
|
14
|
+
{ id: '3', label: 'G3', completed: true },
|
|
15
|
+
{ id: '4', label: 'G4', completed: true },
|
|
16
|
+
{ id: '5', label: 'G5', completed: false, isReward: true },
|
|
17
|
+
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StreaksStep } from '../types.js';
|
|
2
|
+
|
|
3
|
+
/** Demo-only seed data for local dev / playground. */
|
|
4
|
+
export const demoStreaksSteps: StreaksStep[] = [
|
|
5
|
+
{ id: '1', label: 'G1', completed: true },
|
|
6
|
+
{ id: '2', label: 'G2', completed: true },
|
|
7
|
+
{ id: '3', label: 'G3', completed: true },
|
|
8
|
+
{ id: '4', label: 'G4', completed: false },
|
|
9
|
+
{ id: '5', label: 'G5', completed: false, isReward: true },
|
|
10
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Streaks feature — public API.
|
|
3
|
+
* Import this entry in apps: `import '@skinforge/streaks'`
|
|
4
|
+
*/
|
|
5
|
+
export type { StreaksStep } from './types.js';
|
|
6
|
+
export {
|
|
7
|
+
SF_STREAKS_TAG,
|
|
8
|
+
DEFAULT_STREAKS_TITLE,
|
|
9
|
+
DEFAULT_STREAKS_SUBTITLE,
|
|
10
|
+
DEFAULT_STREAKS_STEPS,
|
|
11
|
+
} from './constants.js';
|
|
12
|
+
export { STREAKS_STEP_CLICK } from './events.js';
|
|
13
|
+
export type { StreaksStepClickDetail } from './events.js';
|
|
14
|
+
export { SfStreaks } from './sf-streaks.js';
|
|
15
|
+
|
|
16
|
+
import './sf-streaks.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<div class="container">
|
|
2
|
+
<div class="header">
|
|
3
|
+
<div class="title-section">
|
|
4
|
+
<h2 class="title">${this._streaksTitle}</h2>
|
|
5
|
+
<p class="subtitle">${this._streaksSubtitle}</p>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="wheel-container">
|
|
8
|
+
<div class="wheel-ring"></div>
|
|
9
|
+
${this._renderWheel()}
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div class="steps-container">
|
|
14
|
+
${this._renderSteps()}
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div class="progress-bar">
|
|
18
|
+
<div class="progress-track">
|
|
19
|
+
<div class="progress-fill" style="width: ${this._animatedProgress}%"></div>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="progress-text">
|
|
22
|
+
<span>${this.completedCount} of ${this._streaksSteps.length} completed</span>
|
|
23
|
+
<span class="progress-percentage">${Math.round(this.progress)}%</span>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|