@trading-game/design-intelligence-layer 0.8.5
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/AGENTS.md +70 -0
- package/README.md +464 -0
- package/dist/index.cjs +6798 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +611 -0
- package/dist/index.d.ts +611 -0
- package/dist/index.js +6473 -0
- package/dist/index.js.map +1 -0
- package/docs/accessibility-standards/trading-game-accessibility-standards.md +101 -0
- package/docs/design-principles/trading-game-design-principles.md +97 -0
- package/docs/design-system-guide/trading-game-ds-guide.md +2193 -0
- package/docs/personas/trading-game-player-field-guide.md +213 -0
- package/docs/rules/design-system-consuming-project.mdc +208 -0
- package/docs/tone-of-voice/trading-game-tone-of-voice-and-campaign-brief.md +290 -0
- package/package.json +85 -0
- package/src/styles.css +398 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# trading.game — Player field guide
|
|
2
|
+
|
|
3
|
+
*Who we're writing for. Not personas — modes. The same person cycles through all three.*
|
|
4
|
+
|
|
5
|
+
Version 1.0 · 2026
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The one thing that ties them all together
|
|
10
|
+
|
|
11
|
+
> "This isn't gambling dressed up in crypto jargon."
|
|
12
|
+
|
|
13
|
+
Nobody says this sentence out loud. They think it. Constantly. About their own behaviour.
|
|
14
|
+
|
|
15
|
+
These players are not degenerate gamblers. They are not reckless. They are people with strong opinions about where things go next — markets, matches, prices, events — who have found platforms that let them back those opinions with real money and get an answer fast.
|
|
16
|
+
|
|
17
|
+
The self-image they're protecting is: *I have good reads.* Not "I got lucky." Not "I enjoy risk." I. Have. Good. Reads.
|
|
18
|
+
|
|
19
|
+
Every piece of trading.game copy is either reinforcing that self-image or accidentally destroying it. There is no neutral position. Copy that says "your selection was incorrect" destroys it. Copy that says "market moved at the last second" preserves it. The player in both cases lost. What they do next depends entirely on which sentence they read.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Three modes, one player
|
|
24
|
+
|
|
25
|
+
### Mode 1 — The Edge Seeker
|
|
26
|
+
|
|
27
|
+
**The self-image sentence:** *"I have an edge. I've done the research."*
|
|
28
|
+
|
|
29
|
+
This is the player who genuinely believes their read is information-based. They've watched enough charts, followed enough accounts, tracked enough outcomes to feel like they see things the market hasn't priced in yet. They know the Polymarket stat: during the 2024 US election, prediction markets outperformed every major poll. They know this because it confirms something they already believe about themselves — that paying attention is a competitive advantage.
|
|
30
|
+
|
|
31
|
+
They approach a trade the way the Polymarket Playbook describes catalyst momentum trading: *"Traders with real-time news feeds can enter positions in the first 30 seconds and exit as late-movers pile in."* That's who they think they are. The early mover. The one who saw it first.
|
|
32
|
+
|
|
33
|
+
In practice, they're usually the retail trader the article was warning against: *"If you're still betting based on gut feelings and Twitter polls, you're exiting liquidity for algorithmic traders."* But they don't know this. And the product doesn't need to tell them. The product needs to give their read a fast resolution and let reality do the rest.
|
|
34
|
+
|
|
35
|
+
**What they actually say:**
|
|
36
|
+
|
|
37
|
+
- *"This level has held three times. I'm not guessing, I'm reading the chart."*
|
|
38
|
+
- *"Everyone's fading this but the data says otherwise. I'm taking the other side."*
|
|
39
|
+
- *"Fed catalyst at 2pm. I had my position in before the headline hit Twitter."*
|
|
40
|
+
- *"4 for 5 this week. My read on this setup is getting cleaner."*
|
|
41
|
+
- *"Down today but the process was right. Bad fill, not a bad read."*
|
|
42
|
+
|
|
43
|
+
That last line. *Down today but the process was right.* This is the most important sentence in the field guide. It is the cognitive move the brain makes to survive a loss without abandoning the system. It separates someone who goes again from someone who uninstalls. trading.game copy needs to hand them this sentence, or a version of it, every time they bust.
|
|
44
|
+
|
|
45
|
+
**What they brag about:**
|
|
46
|
+
|
|
47
|
+
Not money. Timing. *"I got in before the move."* Specifically, the moment of being right before other people realise they're wrong. The 10x hit matters less than the fact that they saw it coming. Screenshots go up on X with the chart annotated: *"Flagged this level two days ago. Look at that."*
|
|
48
|
+
|
|
49
|
+
**What kills the mode:**
|
|
50
|
+
|
|
51
|
+
Any framing that suggests randomness. If the resolution feels arbitrary — if the line moves in a way that reads as noise, not signal — they don't just lose, they lose trust in the product. They need the mechanic to feel like it responds to real information, even when the underlying feed is synthetic. The chart has to look like a chart. The resolution has to feel like it followed the logic of the market, even when the market is a GBM simulation.
|
|
52
|
+
|
|
53
|
+
**Copy that works:**
|
|
54
|
+
|
|
55
|
+
- *"The chart moved. You called it."*
|
|
56
|
+
- *"Rise. Your read, confirmed."*
|
|
57
|
+
- *"Bust. Vol spiked at the last tick. Happens."*
|
|
58
|
+
- *"Still up 3 this week. Keep reading."*
|
|
59
|
+
|
|
60
|
+
**Copy that kills it:**
|
|
61
|
+
|
|
62
|
+
- *"Your selection was incorrect."* (removes agency entirely)
|
|
63
|
+
- *"Play again for another chance to win!"* (it's not a chance, it's a read)
|
|
64
|
+
- *"Lucky break!"* (luck is the opposite of edge)
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### Mode 2 — The System Runner
|
|
69
|
+
|
|
70
|
+
**The self-image sentence:** *"I'm not just playing. I have rules."*
|
|
71
|
+
|
|
72
|
+
This player has a spreadsheet, or thinks they do. They've been on Stake or Rollbit. They know the house edge — they can tell you the exact percentage. They've read about martingale. They've tested martingale. They've busted on martingale twice and now have a modified version that caps at three steps, which they believe has eliminated the downside while preserving the upside.
|
|
73
|
+
|
|
74
|
+
They are not delusional. They understand probability better than most. What they're doing is building a model — a framework that makes the activity feel like engineering rather than gambling. The model is usually wrong. But the act of having a model is what keeps them going, because it means every session is data, not just outcome.
|
|
75
|
+
|
|
76
|
+
From the Polyburg psychology research: *"Accountability pressure — when people know they'll be held accountable for their decisions, they engage in more thorough information processing."* This player feels accountable to their own system. The system is the thing. Winning validates the system. Losing exposes a flaw in the current version, which needs to be iterated on. They will be back tomorrow with a tighter ruleset.
|
|
77
|
+
|
|
78
|
+
**What they actually say:**
|
|
79
|
+
|
|
80
|
+
- *"I go max 3 martingale steps then flat bet. That's the discipline piece most people skip."*
|
|
81
|
+
- *"Down 400 this session but the month I'm still net positive. Variance is part of any system."*
|
|
82
|
+
- *"Provably fair matters. At least I know the edge is fixed and I'm not getting cheated."*
|
|
83
|
+
- *"My win rate over 80 samples on this setup is 63%. That's not a guess, that's a sample."*
|
|
84
|
+
- *"One more to get back to flat. Just one."*
|
|
85
|
+
|
|
86
|
+
That last line is not a strategy. It is the sound of the loop engaging. It is the most expensive sentence in crypto gambling. trading.game copy should never be the thing that triggers it — but it should absolutely understand that this is what's running in the background.
|
|
87
|
+
|
|
88
|
+
**What they brag about:**
|
|
89
|
+
|
|
90
|
+
Session stats. Monthly net figures. System iteration — *"New rules: max 5 steps, not 7. Adjusted after last week."* The public post that says *"Month review: +340 USDT net, 12 winning sessions, 8 losing. Still refining"* is not a win post. It is a system update. The brag is the discipline, not the number.
|
|
91
|
+
|
|
92
|
+
Also: multipliers, not amounts. *"Hit 200x on a 0.01 stake"* is the screenshot. The absolute return is irrelevant. The multiplier is the story.
|
|
93
|
+
|
|
94
|
+
**What kills the mode:**
|
|
95
|
+
|
|
96
|
+
Loss streaks without narrative. Five busts in a row with no contextual copy leaves the brain with nothing to hold onto. *"BUST. BUST. BUST. BUST. BUST."* feels rigged. Each bust needs one line that gives the loss a shape — *"Tight range. Market didn't move."* / *"Vol index pinned at resistance."* — something that makes the loss legible without assigning blame.
|
|
97
|
+
|
|
98
|
+
Also: withdrawal friction. This community has long institutional memory around platforms that make it easy to deposit and hard to withdraw. It is the single most common Reddit complaint across Stake, Rollbit, and every Deriv-adjacent product. If trading.game makes withdrawal clean and instant, say so explicitly. The bar is low because the competition set it low.
|
|
99
|
+
|
|
100
|
+
**Copy that works:**
|
|
101
|
+
|
|
102
|
+
- *"Bust. Market barely moved. Try a different setup."*
|
|
103
|
+
- *"System running? 3-game streak. Keep the rules tight."*
|
|
104
|
+
- *"Withdrawal confirmed. On its way."* (no friction, no delay copy)
|
|
105
|
+
- *"Your stats. 7 trades. 4 wins. 57%."*
|
|
106
|
+
|
|
107
|
+
**Copy that kills it:**
|
|
108
|
+
|
|
109
|
+
- *"WIN BIG"* or jackpot language — strips the system frame immediately
|
|
110
|
+
- Any slot aesthetic — visual language that says *this is a casino* breaks the engineering self-image
|
|
111
|
+
- *"Please try again"* — the word "please" is a tell. It sounds like a machine apologising. Systems don't apologise.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### Mode 3 — The Public Predictor
|
|
116
|
+
|
|
117
|
+
**The self-image sentence:** *"I called it. And I can prove it."*
|
|
118
|
+
|
|
119
|
+
This player's win only counts if someone witnessed it. The prediction is not complete until it is posted. They run a public record — a spreadsheet linked in their bio, a weekly X post, a pinned Discord message. The number that matters is not their balance. It is their running unit total and their public win rate.
|
|
120
|
+
|
|
121
|
+
From the Polyburg piece: the prediction market creates *"accountability pressure"* that makes people think more carefully. But for this player, the accountability isn't to the money. It's to the audience. They have built an identity around being demonstrably right over time. A single bad week is a variance event. A bad month is a crisis of identity.
|
|
122
|
+
|
|
123
|
+
They are in esports prediction communities. Fantasy sports leagues. Kalshi. They liked Polymarket before it got too slow and too liquid — when the edge was in being first to a niche market that the crowd hadn't found yet. They are, in the language of every crypto community they've ever inhabited, *early.*
|
|
124
|
+
|
|
125
|
+
Being early is not a strategy. It is a personality trait that functions as a brand. *"I was on trading.game before anyone knew about it."* That sentence, said six months from now in a Discord, is the first-mover acquisition flywheel. This is the person who tells people. Write for them and the next hundred come for free.
|
|
126
|
+
|
|
127
|
+
**What they actually say:**
|
|
128
|
+
|
|
129
|
+
- *"Week 22: 9-5, +3.1 units. Running total since January: +31.2 units. Screenshot below."*
|
|
130
|
+
- *"I had this market at 70% when Kalshi had it at 55%. Took it. It resolved 100%. That's what reading the room looks like."*
|
|
131
|
+
- *"Everyone was on the favourite. I took the value side. Positive EV call even if it doesn't land."*
|
|
132
|
+
- *"Got in on [platform] when nobody knew about it. Already at level 4."*
|
|
133
|
+
- *"My friends bet for fun. I track my record. There's a difference."*
|
|
134
|
+
- *"Statistically it happens. Still a good bet at those odds."* (loss framing)
|
|
135
|
+
|
|
136
|
+
That last line is the prediction market version of *"direction was right, timing was off."* It is the self-image protection sentence for someone who thinks in probability. They didn't lose. The low-probability outcome materialised. The decision was still correct given the information available. The market just disagreed this once.
|
|
137
|
+
|
|
138
|
+
**What they brag about:**
|
|
139
|
+
|
|
140
|
+
The public record above everything. Long shot calls that landed. Being early to a platform or a market. The specific mechanic of a near-win that they survived — *"55.50, I needed 55.51, I had under, I won."* The granularity of that number is the whole point. It proves they were paying attention.
|
|
141
|
+
|
|
142
|
+
They share results through the product's own UI. The result card, the streak, the win state — these are designed content. If the screenshot of a trading.game result is ugly or generic, it won't get posted. The result screen is a distribution channel.
|
|
143
|
+
|
|
144
|
+
**What kills the mode:**
|
|
145
|
+
|
|
146
|
+
Generic copy on win and loss states. *"Well done!"* means nothing to someone who just called a five-tick streak. The win state should acknowledge the specific mechanic. *"5-tick streak. Vol moved exactly where you said."* is a sentence they will screenshot. *"You won! Claim your reward."* is not.
|
|
147
|
+
|
|
148
|
+
Also: anything that makes them feel like a beginner. Tutorial prompts, explanatory overlays mid-game, onboarding copy that explains how markets work — all of this is an insult. They know how markets work. They've been tracking them since before trading.game existed.
|
|
149
|
+
|
|
150
|
+
**Copy that works:**
|
|
151
|
+
|
|
152
|
+
- *"Called it. +1,250 USDT. 5-tick streak."*
|
|
153
|
+
- *"You were early on that move. Vol 75 confirmed."*
|
|
154
|
+
- *"Streak: 7. Post this."* (literal invitation to share)
|
|
155
|
+
- *"Bust. Still 6 from 9 today. Record stands."*
|
|
156
|
+
|
|
157
|
+
**Copy that kills it:**
|
|
158
|
+
|
|
159
|
+
- *"Great job!"* — kindergarten energy
|
|
160
|
+
- *"You're getting the hang of this!"* — implies they didn't already have it
|
|
161
|
+
- Generic push notification: *"A new game is available."* — means nothing to someone building a documented track record
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Where the modes bleed together
|
|
166
|
+
|
|
167
|
+
The same player, in a single session:
|
|
168
|
+
|
|
169
|
+
Opens the app in Edge Seeker mode — *"I've been watching this vol index all week, I have a read."* Places three trades. Wins two. Third one busts. Drops into System Runner mode — *"Okay, variance. My system long-term is positive. One more."* Wins the fourth. Screenshots it. Posts it in Mode 3 with the caption: *"Back to even. System held."*
|
|
170
|
+
|
|
171
|
+
That is one person. One session. Three modes.
|
|
172
|
+
|
|
173
|
+
The copy implication: every state needs to be written to land across all three simultaneously. *"Bust. Market moved at the last tick."* gives Mode 1 a narrative (the market, not their read). Tells Mode 2 the system wasn't broken (external event). Lets Mode 3 post *"Bust but you can see the vol spike at the exact moment, setup was right"* without embarrassment.
|
|
174
|
+
|
|
175
|
+
One sentence. Three self-images intact. Player goes again.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## The near-miss — the mechanic no one talks about
|
|
180
|
+
|
|
181
|
+
This applies in all three modes.
|
|
182
|
+
|
|
183
|
+
When the price lands 0.01 from the target — when the dice rolls 55.49 and they needed 55.50 — the brain does not register a loss. It registers *I was right and the resolution was imprecise.* This is neurologically distinct from a clean loss. The near-miss is more motivating than a win, because a win ends the tension. A near-miss keeps it alive.
|
|
184
|
+
|
|
185
|
+
The animation of the resolution — the line landing one tick short, the number stopping just before the target — is not a UX detail. It is the single most powerful retention mechanic in the product. It should be treated with the same deliberateness as any major feature.
|
|
186
|
+
|
|
187
|
+
Copy for near-miss states should never say the player was wrong. They almost weren't.
|
|
188
|
+
|
|
189
|
+
- *"One tick short. The read was right."*
|
|
190
|
+
- *"55.49. You had 55.50. Next one."*
|
|
191
|
+
- *"Close. Vol reversed at the last second."*
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## What trading.game is selling, in their language
|
|
196
|
+
|
|
197
|
+
Not their words. Theirs.
|
|
198
|
+
|
|
199
|
+
| What the product is | What the player calls it |
|
|
200
|
+
|---|---|
|
|
201
|
+
| A synthetic GBM price feed | *"A live market"* |
|
|
202
|
+
| A 50/50 binary outcome | *"My read, tested"* |
|
|
203
|
+
| A house edge of 2% | *"Known edge. Provably fair."* |
|
|
204
|
+
| A 5-tick resolution | *"Fast feedback on the call"* |
|
|
205
|
+
| A streak counter | *"My record"* |
|
|
206
|
+
| A win state | *"Called it"* |
|
|
207
|
+
| A loss state | *"Market moved. Next one."* |
|
|
208
|
+
|
|
209
|
+
The product doesn't have to lie about what it is. It just has to use the player's language for it. They are not playing a synthetic random number game. They are testing a read against a live market. The first sentence feels like gambling. The second feels like trading.game.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
*trading.game Player Field Guide — v1.0. Use alongside the Content Style Guide when writing any player-facing copy. These are not character studies — they are the modes the player is in when they read what you write.*
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce correct usage of the @trading-game/design-intelligence-layer npm package. Apply whenever building UI in a project that has the package installed — before writing any component, layout, or styled element.
|
|
3
|
+
globs: ["**/*.tsx", "**/*.jsx", "**/*.ts", "**/*.css"]
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# @trading-game/design-intelligence-layer — AI Agent Usage Rules
|
|
8
|
+
|
|
9
|
+
## Rule 1 — Check the package before writing any custom UI
|
|
10
|
+
|
|
11
|
+
**BEFORE** writing any `<div>`, `<button>`, `<span>`, or other element styled with Tailwind classes, you MUST check if a component already exists in `@trading-game/design-intelligence-layer`.
|
|
12
|
+
|
|
13
|
+
### Available components (check this list first)
|
|
14
|
+
|
|
15
|
+
Accordion, Alert, AlertDialog, Avatar, AvatarGroup, Badge, Breadcrumb, Button, Calendar, Card, Carousel, Chart, Checkbox, Collapsible, Combobox, Command, ContextMenu, Dialog, Drawer, DropdownMenu, EmptyState, Field, Form, HoverCard, Input, InputGroup, InputOTP, Item, Kbd, Label, Menubar, NativeSelect, NavigationMenu, Pagination, Popover, Progress, RadioGroup, Resizable, ScrollArea, Select, Separator, Sheet, Sidebar, Skeleton, Slider, Spinner, Switch, Table, Tabs, Textarea, Toast/Toaster, Toggle, ToggleGroup, Tooltip
|
|
16
|
+
|
|
17
|
+
### Decision flow
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
Does a component exist in the list above?
|
|
21
|
+
YES → Import it from @trading-game/design-intelligence-layer. Do NOT re-implement it.
|
|
22
|
+
NO → STOP. Tell the user:
|
|
23
|
+
"The [ComponentName] component does not exist in @trading-game/design-intelligence-layer.
|
|
24
|
+
Options:
|
|
25
|
+
(a) Build a custom one using design system tokens only
|
|
26
|
+
(b) Use a different existing component
|
|
27
|
+
(c) Skip this component"
|
|
28
|
+
Wait for user to choose. Do NOT proceed without confirmation.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Correct import pattern
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { Button, Card, Badge } from "@trading-game/design-intelligence-layer"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Rule 2 — Token-only rule (applies to ALL code, including approved custom builds)
|
|
40
|
+
|
|
41
|
+
### Never use
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
❌ Hardcoded hex: #2323FF, #000000, rgba(0,0,0,0.5)
|
|
45
|
+
❌ Raw Tailwind palette: bg-gray-100, text-zinc-500, text-slate-400, bg-black, bg-white
|
|
46
|
+
❌ Arbitrary color: bg-[#EEEEEE], text-[rgba(35,35,255,0.1)]
|
|
47
|
+
❌ Raw CSS var: bg-[var(--border-subtle)] ← NEVER do this
|
|
48
|
+
❌ hsl(var()) syntax: hsl(var(--primary)) ← this is Tailwind v3, not v4
|
|
49
|
+
❌ Raw opacity on non-tokens: bg-black/50
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Always use semantic token classes
|
|
53
|
+
|
|
54
|
+
#### Background tokens
|
|
55
|
+
```
|
|
56
|
+
✅ bg-background — page background (white #FFFFFF)
|
|
57
|
+
✅ bg-card — card/panel surface (white #FFFFFF)
|
|
58
|
+
✅ bg-popover — popover/dropdown surface (white #FFFFFF)
|
|
59
|
+
✅ bg-subtle — subtle tinted surface (#F5F5F5)
|
|
60
|
+
✅ bg-overlay — modal/dialog backdrop (black 50%) — ONLY for overlays
|
|
61
|
+
✅ bg-primary — brand blue #2323FF — CTAs and primary actions
|
|
62
|
+
✅ bg-primary-hover — darker blue #0B0BD2 — primary button hover
|
|
63
|
+
✅ bg-secondary-hover — light grey #EEEEEE — outline/secondary button hover
|
|
64
|
+
✅ bg-semantic-win — green — profit/positive
|
|
65
|
+
✅ bg-semantic-loss — red — loss/negative
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### Text tokens
|
|
69
|
+
```
|
|
70
|
+
✅ text-on-prominent — primary text (black #000000)
|
|
71
|
+
✅ text-on-prominent-static-inverse — always white — for text on dark/primary bg
|
|
72
|
+
✅ text-on-subtle — secondary text (mid grey)
|
|
73
|
+
✅ text-on-muted — low emphasis text (dark grey)
|
|
74
|
+
✅ text-primary — brand blue #2323FF
|
|
75
|
+
✅ text-semantic-win — green — profit/positive
|
|
76
|
+
✅ text-semantic-loss — red — loss/negative
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Border tokens
|
|
80
|
+
```
|
|
81
|
+
✅ border-border-subtle — light grey #EEEEEE — default UI borders, dividers, cards
|
|
82
|
+
✅ border-border-prominent — pure black #000000 — outline variant components
|
|
83
|
+
✅ border-border — @deprecated alias for border-subtle (still works, prefer border-border-subtle)
|
|
84
|
+
✅ border-input — input field borders (same value as border-subtle)
|
|
85
|
+
✅ ring-ring — focus ring (blue #2323FF)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Opacity on a token is fine
|
|
89
|
+
```
|
|
90
|
+
✅ bg-primary/20, border-border-subtle/50, ring-ring/10
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Rule 3 — Layout utilities are exempt
|
|
96
|
+
|
|
97
|
+
Structural Tailwind utilities are freely usable without token rules:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
✅ flex, grid, gap-4, p-6, m-2, w-full, h-screen, max-w-lg
|
|
101
|
+
✅ z-50, overflow-hidden, opacity-50, transition-all
|
|
102
|
+
✅ col-span-2, items-center, justify-between
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Token rules apply **only** to: color (bg, text, border, ring, shadow color), border radius, and font family.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Rule 4 — Do NOT install or configure these separately
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
❌ Do NOT install lucide-react — it is already bundled in the package
|
|
113
|
+
❌ Do NOT install tailwindcss separately — the package ships its own Tailwind v4 setup
|
|
114
|
+
❌ Do NOT add a tailwind.config.js — configuration is handled by the package
|
|
115
|
+
❌ Do NOT use @apply with hsl(var(--token)) — Tailwind v4 uses CSS variables directly
|
|
116
|
+
❌ Do NOT override font-family manually in CSS — use font-display and font-body utility classes
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Correct CSS setup in the consuming project
|
|
120
|
+
|
|
121
|
+
```css
|
|
122
|
+
@import "@trading-game/design-intelligence-layer/styles";
|
|
123
|
+
@import "tailwindcss";
|
|
124
|
+
@source "../node_modules/@trading-game/design-intelligence-layer/dist";
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Vite projects — required plugin
|
|
128
|
+
|
|
129
|
+
If the project uses Vite, `@tailwindcss/vite` MUST be in `vite.config.js`:
|
|
130
|
+
|
|
131
|
+
```js
|
|
132
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
133
|
+
// plugins: [react(), tailwindcss()]
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Without this, Tailwind CSS will not process any styles. Next.js projects do NOT need this.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Rule 5 — Button and Badge variants
|
|
141
|
+
|
|
142
|
+
### Button variants
|
|
143
|
+
```tsx
|
|
144
|
+
<Button variant="primary" /> // Blue filled — main CTA
|
|
145
|
+
<Button variant="secondary" /> // Black outline, white bg — secondary actions
|
|
146
|
+
<Button variant="tertiary" /> // Text only, underline on hover — minimal
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Badge variants
|
|
150
|
+
```tsx
|
|
151
|
+
// Solid
|
|
152
|
+
<Badge variant="default" /> // Blue solid
|
|
153
|
+
<Badge variant="default-success" /> // Green solid
|
|
154
|
+
<Badge variant="default-fail" /> // Red solid
|
|
155
|
+
|
|
156
|
+
// Tint
|
|
157
|
+
<Badge variant="fill" /> // Blue tint bg
|
|
158
|
+
<Badge variant="fill-success" /> // Green tint bg
|
|
159
|
+
<Badge variant="fill-fail" /> // Red tint bg
|
|
160
|
+
|
|
161
|
+
// Outline (black border, hover grey)
|
|
162
|
+
<Badge variant="outline" />
|
|
163
|
+
|
|
164
|
+
// Ghost (transparent bg)
|
|
165
|
+
<Badge variant="ghost" />
|
|
166
|
+
<Badge variant="ghost-success" />
|
|
167
|
+
<Badge variant="ghost-fail" />
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Rule 6 — If in doubt, stop and ask
|
|
173
|
+
|
|
174
|
+
If you cannot find a token for a value you need, do NOT fall back to a hardcoded value.
|
|
175
|
+
|
|
176
|
+
Stop and tell the user:
|
|
177
|
+
```
|
|
178
|
+
"I need [value] for [element]. No design token exists for this.
|
|
179
|
+
Should I: (a) use a hardcoded value, or (b) skip this styling?"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Wait for confirmation before proceeding.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Rule 7 — Package version upgrades (stay aligned with the published design system)
|
|
187
|
+
|
|
188
|
+
When the user asks to **update**, **upgrade**, or **install the latest** `@trading-game/design-intelligence-layer`, or after the dependency version changes in `package.json`:
|
|
189
|
+
|
|
190
|
+
### How updates actually apply
|
|
191
|
+
|
|
192
|
+
- If the project **imports components only** from `@trading-game/design-intelligence-layer`, new styles and behavior come from **`node_modules/.../dist`** after **`npm install` / `npm ci` and a dev or production build**. The package is the source of truth — no AI step is required for those imports to change.
|
|
193
|
+
- If the repo **contains copied or forked** files that mirror package components (e.g. a local `components/ui/button.tsx` with full implementation), **`npm install` does not update those files.** They stay stale until someone reconciles them.
|
|
194
|
+
|
|
195
|
+
### What you MUST do after a design-system version bump
|
|
196
|
+
|
|
197
|
+
1. **Search for local duplication** — Look for UI files that re-implement package exports (`components/ui/`, `@/components/ui`, etc.). Flag any file that is not a **thin re-export** or **documented wrapper** around the package.
|
|
198
|
+
2. **Reconcile** — Prefer **removing** duplicate implementations and **importing from the package**. If a fork must stay, align it with the **exact** current implementation in the installed package (or tag on GitHub) and document why it diverges (file name + reason).
|
|
199
|
+
3. **Notify on replace** — If you **delete, replace, or substantially overwrite** local component code to match the package, **stop and tell the user clearly**, e.g.
|
|
200
|
+
`Aligned [ComponentName] with @trading-game/design-intelligence-layer@[version]. Previous local behavior or classes: [short summary]. Re-apply needs via package variants/props, tokens, or a thin wrapper only if product requires it.`
|
|
201
|
+
4. **Review `className` overrides** — Parent apps often pass `className` on DS components. Old overrides (radius, colors, shadows) can **hide** new defaults (e.g. pill buttons). After upgrade, scan for overrides on DS components and trim or adjust them when they conflict with the new design.
|
|
202
|
+
5. **Refresh Cursor rules** — The package ships `docs/rules/design-system-consuming-project.mdc`. Cursor does **not** read it from `node_modules` automatically. Tell the user to re-copy it (see README **AI Agent Setup → Cursor**) so agent instructions match the release.
|
|
203
|
+
6. **Tailwind** — Confirm `@source` still points at `node_modules/@trading-game/design-intelligence-layer/dist` so Tailwind v4 emits classes from the updated bundle.
|
|
204
|
+
|
|
205
|
+
### Do not assume
|
|
206
|
+
|
|
207
|
+
- Do **not** assume `npm update` alone fixed forked files in the app repo.
|
|
208
|
+
- Do **not** silently delete user customizations — always report what was removed or replaced and offer a token-safe way to re-apply if needed.
|