@trading-game/design-intelligence-layer 0.8.9 → 0.9.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/AGENTS.md +2 -1
- package/README.md +15 -4
- package/dist/index.cjs +16 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/guides/design-system-guide/trading-game-ds-guide.md +44 -5
- package/guides/rules/design-system-consuming-project.mdc +20 -1
- package/package.json +1 -1
- package/src/styles.css +3 -3
package/AGENTS.md
CHANGED
|
@@ -53,10 +53,11 @@ cp node_modules/@trading-game/design-intelligence-layer/guides/rules/design-syst
|
|
|
53
53
|
## Step 3 — Core rules summary
|
|
54
54
|
|
|
55
55
|
1. **Check before building** — if a component exists in `@trading-game/design-intelligence-layer`, import it. Never re-implement it.
|
|
56
|
-
2. **Tokens only** — use semantic token classes (`bg-
|
|
56
|
+
2. **Tokens only** — use semantic token classes (`bg-prominent`, `text-on-prominent`, `border-border`, etc.). Never hardcode hex values, raw Tailwind palette colors, or CSS variables.
|
|
57
57
|
3. **Design principles and accessibility first** — every screen must reflect the 8 design principles and meet the accessibility standards (WCAG 2.1 AA). Run both checklists before shipping.
|
|
58
58
|
4. **No separate installs** — do not install `lucide-react`, `tailwindcss`, or other bundled dependencies separately.
|
|
59
59
|
5. **After a version bump** — re-copy the rules file into `.cursor/rules/`, check for stale local component copies, and align them with the package.
|
|
60
|
+
6. **Blocks are playground-only** — Blocks (e.g. NavBar) appear in the playground's Blocks tab but are **not** exported from the package. Do not try to import them. To build a block pattern in a consuming project, compose it manually using package components and design tokens. See `guides/design-system-guide/trading-game-ds-guide.md` Section 8.5.
|
|
60
61
|
|
|
61
62
|
---
|
|
62
63
|
|
package/README.md
CHANGED
|
@@ -155,6 +155,17 @@ npm install react react-dom tailwindcss
|
|
|
155
155
|
|
|
156
156
|
---
|
|
157
157
|
|
|
158
|
+
## Blocks
|
|
159
|
+
|
|
160
|
+
Blocks are pre-composed UI patterns built from design system primitives. They are demonstrated in the **Blocks** tab of the development playground and are **not** exported from the npm package — import the underlying components directly if you need to use them.
|
|
161
|
+
|
|
162
|
+
| Block | Variants | Description |
|
|
163
|
+
|---|---|---|
|
|
164
|
+
| NavBar | Desktop, Mobile (closed), Mobile (open) | Landing page top navigation bar. Logo + ghost nav links (Products, Use Cases, Docs, Blog, FAQ) + Sign in / Sign up CTAs. |
|
|
165
|
+
| Hero | Type 1 (Desktop + Mobile), Type 2 | Landing page hero sections. Type 1: tagline pill + heading + body + CTAs left, image right (responsive). Type 2: centred single-column, tagline pill + heading + body + primary CTA with arrow icon, no image. |
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
158
169
|
## Button variants and sizes
|
|
159
170
|
|
|
160
171
|
```tsx
|
|
@@ -242,7 +253,7 @@ All tokens are CSS custom properties, loaded automatically via `@trading-game/de
|
|
|
242
253
|
|
|
243
254
|
| Tailwind class | CSS variable | Value | Usage |
|
|
244
255
|
|---|---|---|---|
|
|
245
|
-
| `bg-
|
|
256
|
+
| `bg-prominent` | `--prominent` | `#FFFFFF` | Page background |
|
|
246
257
|
| `bg-card` | `--card` | `#FFFFFF` | Card/panel surface |
|
|
247
258
|
| `bg-popover` | `--popover` | `#FFFFFF` | Popover/dropdown surface |
|
|
248
259
|
| `bg-subtle` | `--subtle` | `#F5F5F5` | Subtle tinted surface |
|
|
@@ -319,7 +330,7 @@ Opacity on tokens is allowed and encouraged:
|
|
|
319
330
|
✅ ring-ring/10 → ring at 10% opacity
|
|
320
331
|
|
|
321
332
|
❌ bg-black/50 → NOT a token, use bg-overlay instead
|
|
322
|
-
❌ bg-white → NOT a token, use bg-
|
|
333
|
+
❌ bg-white → NOT a token, use bg-prominent or bg-card
|
|
323
334
|
```
|
|
324
335
|
|
|
325
336
|
### Primitive alpha scales
|
|
@@ -449,7 +460,7 @@ This project uses @trading-game/design-intelligence-layer. Before writing any UI
|
|
|
449
460
|
3. Read node_modules/@trading-game/design-intelligence-layer/guides/personas/trading-game-player-field-guide.md — understand the 3 player modes (Edge Seeker, System Runner, Public Predictor) that shape all copy and UX
|
|
450
461
|
4. Read node_modules/@trading-game/design-intelligence-layer/guides/tone-of-voice/trading-game-tone-of-voice-and-campaign-brief.md — apply the voice, campaign territories, and mirror test for all player-facing copy
|
|
451
462
|
5. Check if the component exists in the package — import it, don't re-implement
|
|
452
|
-
6. Use only design token classes (bg-
|
|
463
|
+
6. Use only design token classes (bg-prominent, text-on-prominent, border-border-subtle, etc.) — no hardcoded hex or raw Tailwind palette colors
|
|
453
464
|
7. Do not install lucide-react, tailwindcss, or other bundled dependencies separately
|
|
454
465
|
8. If no token exists for a value, ask before using a hardcoded value
|
|
455
466
|
9. After upgrading the package: prefer package imports over local copies of components; if replacing local UI code with the package version, tell the user what was overwritten; re-copy guides/rules/design-system-consuming-project.mdc into .cursor/rules if using Cursor
|
|
@@ -465,7 +476,7 @@ See node_modules/@trading-game/design-intelligence-layer/README.md for complete
|
|
|
465
476
|
| Wrong | Right | Why |
|
|
466
477
|
|---|---|---|
|
|
467
478
|
| `bg-gray-100` | `bg-subtle` | Raw Tailwind palette — use tokens |
|
|
468
|
-
| `bg-white` | `bg-
|
|
479
|
+
| `bg-white` | `bg-prominent` or `bg-card` | Not a semantic token |
|
|
469
480
|
| `text-white` | `text-on-prominent-static-inverse` | Use the semantic inverse token |
|
|
470
481
|
| `text-black` | `text-on-prominent` | Not a semantic token |
|
|
471
482
|
| `bg-black/50` | `bg-overlay` | Overlay has its own token |
|
package/dist/index.cjs
CHANGED
|
@@ -626,7 +626,7 @@ function AlertDialogContent(_a) {
|
|
|
626
626
|
"data-slot": "alert-dialog-content",
|
|
627
627
|
"data-size": size,
|
|
628
628
|
className: cn(
|
|
629
|
-
"group/alert-dialog-content fixed top-[50%] left-[50%] z-50 flex h-auto w-full max-w-[calc(100%-2rem)] flex-col translate-x-[-50%] translate-y-[-50%] gap-6 rounded-sm border border-border-subtle bg-
|
|
629
|
+
"group/alert-dialog-content fixed top-[50%] left-[50%] z-50 flex h-auto w-full max-w-[calc(100%-2rem)] flex-col translate-x-[-50%] translate-y-[-50%] gap-6 rounded-sm border border-border-subtle bg-prominent p-6 shadow-lg duration-base data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",
|
|
630
630
|
className
|
|
631
631
|
)
|
|
632
632
|
}, props)
|
|
@@ -819,7 +819,7 @@ function AvatarBadge(_a) {
|
|
|
819
819
|
__spreadValues({
|
|
820
820
|
"data-slot": "avatar-badge",
|
|
821
821
|
className: cn(
|
|
822
|
-
"absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-on-prominent-static-inverse ring-2 ring-
|
|
822
|
+
"absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-on-prominent-static-inverse ring-2 ring-prominent select-none",
|
|
823
823
|
"group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
|
|
824
824
|
"group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
|
|
825
825
|
"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
|
|
@@ -836,7 +836,7 @@ function AvatarGroup(_a) {
|
|
|
836
836
|
__spreadValues({
|
|
837
837
|
"data-slot": "avatar-group",
|
|
838
838
|
className: cn(
|
|
839
|
-
"group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-
|
|
839
|
+
"group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-prominent",
|
|
840
840
|
className
|
|
841
841
|
)
|
|
842
842
|
}, props)
|
|
@@ -853,7 +853,7 @@ function AvatarGroupCount(_a) {
|
|
|
853
853
|
__spreadValues({
|
|
854
854
|
"data-slot": "avatar-group-count",
|
|
855
855
|
className: cn(
|
|
856
|
-
"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-subtle text-sm text-on-subtle ring-2 ring-
|
|
856
|
+
"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-subtle text-sm text-on-subtle ring-2 ring-prominent group-has-data-[size=sm]/avatar-group:size-6 group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=xl]/avatar-group:[width:var(--avatar-size-xl)] group-has-data-[size=xl]/avatar-group:[height:var(--avatar-size-xl)] [&>svg]:size-4 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=xl]/avatar-group:[&>svg]:size-6",
|
|
857
857
|
className
|
|
858
858
|
)
|
|
859
859
|
}, props)
|
|
@@ -1052,7 +1052,7 @@ function Calendar(_a) {
|
|
|
1052
1052
|
__spreadValues({
|
|
1053
1053
|
showOutsideDays,
|
|
1054
1054
|
className: cn(
|
|
1055
|
-
"group/calendar bg-
|
|
1055
|
+
"group/calendar bg-prominent p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
1056
1056
|
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
1057
1057
|
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
1058
1058
|
className
|
|
@@ -2352,7 +2352,7 @@ function DialogContent(_a) {
|
|
|
2352
2352
|
__spreadProps(__spreadValues({
|
|
2353
2353
|
"data-slot": "dialog-content",
|
|
2354
2354
|
className: cn(
|
|
2355
|
-
"fixed top-[50%] left-[50%] z-50 flex h-auto w-full max-w-[calc(100%-2rem)] flex-col translate-x-[-50%] translate-y-[-50%] gap-6 rounded-sm border border-border-subtle bg-
|
|
2355
|
+
"fixed top-[50%] left-[50%] z-50 flex h-auto w-full max-w-[calc(100%-2rem)] flex-col translate-x-[-50%] translate-y-[-50%] gap-6 rounded-sm border border-border-subtle bg-prominent p-6 shadow-lg duration-base outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
|
|
2356
2356
|
className
|
|
2357
2357
|
)
|
|
2358
2358
|
}, props), {
|
|
@@ -2362,7 +2362,7 @@ function DialogContent(_a) {
|
|
|
2362
2362
|
import_radix_ui10.Dialog.Close,
|
|
2363
2363
|
{
|
|
2364
2364
|
"data-slot": "dialog-close",
|
|
2365
|
-
className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-
|
|
2365
|
+
className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-prominent transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-on-subtle [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
2366
2366
|
children: [
|
|
2367
2367
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react7.XIcon, {}),
|
|
2368
2368
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "sr-only", children: "Close" })
|
|
@@ -2890,7 +2890,7 @@ function DrawerContent(_a) {
|
|
|
2890
2890
|
__spreadProps(__spreadValues({
|
|
2891
2891
|
"data-slot": "drawer-content",
|
|
2892
2892
|
className: cn(
|
|
2893
|
-
"group/drawer-content fixed z-50 flex h-auto flex-col bg-
|
|
2893
|
+
"group/drawer-content fixed z-50 flex h-auto flex-col bg-prominent",
|
|
2894
2894
|
"data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b data-[vaul-drawer-direction=top]:border-border-subtle",
|
|
2895
2895
|
"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t data-[vaul-drawer-direction=bottom]:border-border-subtle",
|
|
2896
2896
|
"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:border-border-subtle data-[vaul-drawer-direction=right]:sm:max-w-sm",
|
|
@@ -4400,7 +4400,7 @@ function NavigationMenuItem(_a) {
|
|
|
4400
4400
|
);
|
|
4401
4401
|
}
|
|
4402
4402
|
var navigationMenuTriggerStyle = (0, import_class_variance_authority9.cva)(
|
|
4403
|
-
"group inline-flex h-9 w-max items-center justify-center rounded-md bg-
|
|
4403
|
+
"group inline-flex h-9 w-max items-center justify-center rounded-md bg-prominent px-4 py-2 text-sm font-medium transition-[color,box-shadow] outline-none hover:bg-secondary-hover hover:text-on-prominent focus:bg-secondary-hover focus:text-on-prominent focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=open]:bg-secondary-hover data-[state=open]:text-on-prominent data-[state=open]:hover:bg-secondary-hover data-[state=open]:focus:bg-secondary-hover"
|
|
4404
4404
|
);
|
|
4405
4405
|
function NavigationMenuTrigger(_a) {
|
|
4406
4406
|
var _b = _a, {
|
|
@@ -5106,7 +5106,7 @@ function SheetContent(_a) {
|
|
|
5106
5106
|
__spreadProps(__spreadValues({
|
|
5107
5107
|
"data-slot": "sheet-content",
|
|
5108
5108
|
className: cn(
|
|
5109
|
-
"fixed z-50 flex flex-col gap-4 bg-
|
|
5109
|
+
"fixed z-50 flex flex-col gap-4 bg-prominent shadow-lg transition ease-standard data-[state=closed]:animate-out data-[state=closed]:duration-slow data-[state=open]:animate-in data-[state=open]:duration-open",
|
|
5110
5110
|
side === "right" && "inset-y-0 right-0 h-full w-3/4 border-l border-border-subtle data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
5111
5111
|
side === "left" && "inset-y-0 left-0 h-full w-3/4 border-r border-border-subtle data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
5112
5112
|
side === "top" && "inset-x-0 top-0 h-auto border-b border-border-subtle data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
@@ -5116,7 +5116,7 @@ function SheetContent(_a) {
|
|
|
5116
5116
|
}, props), {
|
|
5117
5117
|
children: [
|
|
5118
5118
|
children,
|
|
5119
|
-
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_radix_ui27.Dialog.Close, { className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-
|
|
5119
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_radix_ui27.Dialog.Close, { className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-prominent transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
|
|
5120
5120
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react19.XIcon, { className: "size-4" }),
|
|
5121
5121
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "sr-only", children: "Close" })
|
|
5122
5122
|
] })
|
|
@@ -5514,7 +5514,7 @@ function SidebarInset(_a) {
|
|
|
5514
5514
|
__spreadValues({
|
|
5515
5515
|
"data-slot": "sidebar-inset",
|
|
5516
5516
|
className: cn(
|
|
5517
|
-
"relative flex w-full flex-1 flex-col bg-
|
|
5517
|
+
"relative flex w-full flex-1 flex-col bg-prominent",
|
|
5518
5518
|
"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",
|
|
5519
5519
|
className
|
|
5520
5520
|
)
|
|
@@ -5532,7 +5532,7 @@ function SidebarInput(_a) {
|
|
|
5532
5532
|
__spreadValues({
|
|
5533
5533
|
"data-slot": "sidebar-input",
|
|
5534
5534
|
"data-sidebar": "input",
|
|
5535
|
-
className: cn("h-8 w-full bg-
|
|
5535
|
+
className: cn("h-8 w-full bg-prominent shadow-none", className)
|
|
5536
5536
|
}, props)
|
|
5537
5537
|
);
|
|
5538
5538
|
}
|
|
@@ -5687,7 +5687,7 @@ var sidebarMenuButtonVariants = (0, import_class_variance_authority10.cva)(
|
|
|
5687
5687
|
variants: {
|
|
5688
5688
|
variant: {
|
|
5689
5689
|
default: "",
|
|
5690
|
-
outline: "bg-
|
|
5690
|
+
outline: "bg-prominent ring-1 ring-sidebar-border hover:ring-primary/40 data-[active=true]:ring-primary/40"
|
|
5691
5691
|
},
|
|
5692
5692
|
size: {
|
|
5693
5693
|
default: "h-8 text-sm",
|
|
@@ -6322,14 +6322,14 @@ function TicketCard({
|
|
|
6322
6322
|
"div",
|
|
6323
6323
|
{
|
|
6324
6324
|
"aria-hidden": true,
|
|
6325
|
-
className: "pointer-events-none absolute right-0 top-0 z-10 size-5 -translate-y-1/2 translate-x-1/2 rounded-full bg-
|
|
6325
|
+
className: "pointer-events-none absolute right-0 top-0 z-10 size-5 -translate-y-1/2 translate-x-1/2 rounded-full bg-prominent"
|
|
6326
6326
|
}
|
|
6327
6327
|
),
|
|
6328
6328
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6329
6329
|
"div",
|
|
6330
6330
|
{
|
|
6331
6331
|
"aria-hidden": true,
|
|
6332
|
-
className: "pointer-events-none absolute bottom-0 right-0 z-10 size-5 translate-x-1/2 translate-y-1/2 rounded-full bg-
|
|
6332
|
+
className: "pointer-events-none absolute bottom-0 right-0 z-10 size-5 translate-x-1/2 translate-y-1/2 rounded-full bg-prominent"
|
|
6333
6333
|
}
|
|
6334
6334
|
),
|
|
6335
6335
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|