aibos-design-system 1.0.0 → 1.1.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/LICENSE +21 -0
- package/README.md +335 -333
- package/components/README.md +130 -0
- package/components/react/Button.tsx +82 -0
- package/components/react/Card.tsx +73 -0
- package/components/react/README.md +324 -0
- package/components/react/StatusIndicator.tsx +101 -0
- package/components/react/index.ts +17 -0
- package/components/react/nextui-helpers.tsx +88 -0
- package/components/utils.ts +38 -0
- package/dist/headless-map.json +44 -41
- package/dist/tokens/index.d.ts +66 -66
- package/dist/tokens.json +34 -34
- package/{API_REFERENCE.md → docs/API_REFERENCE.md} +379 -379
- package/{EXTERNAL_USAGE.md → docs/EXTERNAL_USAGE.md} +372 -370
- package/docs/INTEGRATION_GUIDE.md +433 -0
- package/docs/QUICK_REFERENCE.md +303 -0
- package/input.css +4056 -4050
- package/lib/cli-autocomplete.ts +231 -0
- package/lib/cli-commands.ts +364 -0
- package/lib/cli-filter-engine.ts +271 -0
- package/lib/cli-parser.ts +197 -0
- package/lib/utils.ts +18 -0
- package/package.json +57 -8
- package/style.css +686 -236
- package/types/aibos-classes.ts +70 -0
- package/types/design-tokens.ts +83 -0
- package/types/index.ts +9 -0
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
# Integration Guide
|
|
2
|
+
|
|
3
|
+
**How to use Neo-Analog design tokens in your projects**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @aibos/design-system
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @aibos/design-system
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 1. CSS/HTML Projects
|
|
18
|
+
|
|
19
|
+
### Import the compiled stylesheet:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<head>
|
|
23
|
+
<link rel="stylesheet" href="node_modules/@aibos/design-system/style.css">
|
|
24
|
+
</head>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Use tokens in CSS:
|
|
28
|
+
|
|
29
|
+
```css
|
|
30
|
+
.my-button {
|
|
31
|
+
background-color: var(--color-gold);
|
|
32
|
+
color: var(--color-void);
|
|
33
|
+
padding: var(--spacing-4);
|
|
34
|
+
border-radius: var(--radius-control);
|
|
35
|
+
font-size: var(--font-size-base);
|
|
36
|
+
font-weight: var(--font-weight-semibold);
|
|
37
|
+
transition: background-color var(--duration-200) var(--ease-premium);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Use token classes in HTML:
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<div class="text-lux bg-paper rounded-card p-6 shadow-card">
|
|
45
|
+
<h3 class="na-h3">Card Title</h3>
|
|
46
|
+
<div class="na-data">$12,450.00</div>
|
|
47
|
+
<div class="na-metadata">Updated 2 hours ago</div>
|
|
48
|
+
</div>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 2. React Projects
|
|
54
|
+
|
|
55
|
+
### Import stylesheet:
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import '@aibos/design-system/style.css';
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Use tokens in CSS-in-JS (Emotion, styled-components):
|
|
62
|
+
|
|
63
|
+
**Styled Components:**
|
|
64
|
+
```tsx
|
|
65
|
+
import styled from 'styled-components';
|
|
66
|
+
|
|
67
|
+
const Card = styled.div`
|
|
68
|
+
background-color: var(--color-paper);
|
|
69
|
+
padding: var(--spacing-6);
|
|
70
|
+
border-radius: var(--radius-card);
|
|
71
|
+
box-shadow: var(--shadow-card);
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
export default function MyComponent() {
|
|
75
|
+
return (
|
|
76
|
+
<Card>
|
|
77
|
+
<h3 className="na-h3">Title</h3>
|
|
78
|
+
<div className="na-data">Value</div>
|
|
79
|
+
</Card>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Emotion:**
|
|
85
|
+
```tsx
|
|
86
|
+
import { css } from '@emotion/react';
|
|
87
|
+
|
|
88
|
+
const cardStyles = css`
|
|
89
|
+
background-color: var(--color-paper);
|
|
90
|
+
padding: var(--spacing-6);
|
|
91
|
+
border-radius: var(--radius-card);
|
|
92
|
+
`;
|
|
93
|
+
|
|
94
|
+
export default function MyComponent() {
|
|
95
|
+
return <div css={cardStyles}>Content</div>;
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Use Tailwind CSS with tokens:
|
|
100
|
+
|
|
101
|
+
All tokens are available as Tailwind utilities:
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
export default function MyComponent() {
|
|
105
|
+
return (
|
|
106
|
+
<div className="bg-paper p-6 rounded-card shadow-card">
|
|
107
|
+
<h3 className="na-h3">Title</h3>
|
|
108
|
+
<button className="bg-gold text-void px-4 py-3 rounded-control">
|
|
109
|
+
Action
|
|
110
|
+
</button>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Get tokens programmatically:
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import tokens from '@aibos/design-system/dist/tokens.json';
|
|
120
|
+
|
|
121
|
+
const spacing = tokens.spacing['6']; // "1.5rem"
|
|
122
|
+
const color = tokens.colors.gold; // "#eab308"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 3. Vue Projects
|
|
128
|
+
|
|
129
|
+
### Import stylesheet:
|
|
130
|
+
|
|
131
|
+
```js
|
|
132
|
+
// main.js
|
|
133
|
+
import '@aibos/design-system/style.css';
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Use tokens in Vue components:
|
|
137
|
+
|
|
138
|
+
```vue
|
|
139
|
+
<template>
|
|
140
|
+
<div class="bg-paper p-6 rounded-card shadow-card">
|
|
141
|
+
<h3 class="na-h3">{{ title }}</h3>
|
|
142
|
+
<div class="na-data">{{ value }}</div>
|
|
143
|
+
</div>
|
|
144
|
+
</template>
|
|
145
|
+
|
|
146
|
+
<script setup>
|
|
147
|
+
defineProps({
|
|
148
|
+
title: String,
|
|
149
|
+
value: String,
|
|
150
|
+
});
|
|
151
|
+
</script>
|
|
152
|
+
|
|
153
|
+
<style scoped>
|
|
154
|
+
.card {
|
|
155
|
+
background-color: var(--color-paper);
|
|
156
|
+
padding: var(--spacing-6);
|
|
157
|
+
border-radius: var(--radius-card);
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 4. Tailwind CSS Integration
|
|
165
|
+
|
|
166
|
+
### Configure tailwind.config.js:
|
|
167
|
+
|
|
168
|
+
```js
|
|
169
|
+
import { colors, spacing } from '@aibos/design-system/dist/tokens.json';
|
|
170
|
+
|
|
171
|
+
export default {
|
|
172
|
+
theme: {
|
|
173
|
+
extend: {
|
|
174
|
+
colors,
|
|
175
|
+
spacing,
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Use in templates:
|
|
182
|
+
|
|
183
|
+
```html
|
|
184
|
+
<div class="bg-paper p-6 rounded-card text-lux">
|
|
185
|
+
<h3 class="text-2xl font-bold">Title</h3>
|
|
186
|
+
<p class="text-clay">Subtitle</p>
|
|
187
|
+
</div>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## 5. TypeScript Projects
|
|
193
|
+
|
|
194
|
+
### Import type definitions:
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
import type { DesignTokens } from '@aibos/design-system/dist/tokens/index.d.ts';
|
|
198
|
+
|
|
199
|
+
const tokens: DesignTokens = require('@aibos/design-system/dist/tokens.json');
|
|
200
|
+
|
|
201
|
+
// Fully typed token access
|
|
202
|
+
const primaryColor: string = tokens.colors.gold;
|
|
203
|
+
const padding: string = tokens.spacing['6'];
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Create typed theme hook (React):
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
import tokens from '@aibos/design-system/dist/tokens.json';
|
|
210
|
+
import type { DesignTokens } from '@aibos/design-system/dist/tokens/index.d.ts';
|
|
211
|
+
|
|
212
|
+
export function useDesignTokens(): DesignTokens {
|
|
213
|
+
return tokens;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Usage
|
|
217
|
+
const MyComponent = () => {
|
|
218
|
+
const tokens = useDesignTokens();
|
|
219
|
+
return (
|
|
220
|
+
<div style={{ color: tokens.colors.lux }}>
|
|
221
|
+
Content
|
|
222
|
+
</div>
|
|
223
|
+
);
|
|
224
|
+
};
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 6. Figma Integration
|
|
230
|
+
|
|
231
|
+
### Export tokens from Figma:
|
|
232
|
+
|
|
233
|
+
1. Open Figma design file
|
|
234
|
+
2. Use Design System → Export Tokens
|
|
235
|
+
3. Paste exported JSON into your project's token file
|
|
236
|
+
|
|
237
|
+
### Keep tokens in sync:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
# Update from Figma
|
|
241
|
+
npm run update:tokens
|
|
242
|
+
|
|
243
|
+
# Rebuild CSS
|
|
244
|
+
npm run build
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## 7. Headless/CSS-Only Projects
|
|
250
|
+
|
|
251
|
+
### Use CSS variables directly:
|
|
252
|
+
|
|
253
|
+
```html
|
|
254
|
+
<!DOCTYPE html>
|
|
255
|
+
<html>
|
|
256
|
+
<head>
|
|
257
|
+
<link rel="stylesheet" href="node_modules/@aibos/design-system/style.css">
|
|
258
|
+
<style>
|
|
259
|
+
body {
|
|
260
|
+
background: var(--color-void);
|
|
261
|
+
color: var(--color-lux);
|
|
262
|
+
font-family: var(--font-family-sans);
|
|
263
|
+
font-size: 15px;
|
|
264
|
+
line-height: 1.6;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.card {
|
|
268
|
+
background: var(--color-paper);
|
|
269
|
+
padding: var(--spacing-6);
|
|
270
|
+
border-radius: var(--radius-card);
|
|
271
|
+
box-shadow: var(--shadow-card);
|
|
272
|
+
}
|
|
273
|
+
</style>
|
|
274
|
+
</head>
|
|
275
|
+
<body>
|
|
276
|
+
<div class="card">
|
|
277
|
+
<h2 class="na-h2">Card Title</h2>
|
|
278
|
+
<p class="na-data">Card content</p>
|
|
279
|
+
</div>
|
|
280
|
+
</body>
|
|
281
|
+
</html>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## 8. Component Libraries
|
|
287
|
+
|
|
288
|
+
### Build on Neo-Analog tokens:
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
// Button.tsx
|
|
292
|
+
import '@aibos/design-system/style.css';
|
|
293
|
+
|
|
294
|
+
interface ButtonProps {
|
|
295
|
+
variant: 'primary' | 'secondary' | 'ghost';
|
|
296
|
+
size: 'sm' | 'md' | 'lg';
|
|
297
|
+
children: React.ReactNode;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export const Button = ({ variant, size, children }: ButtonProps) => {
|
|
301
|
+
const variantClasses = {
|
|
302
|
+
primary: 'bg-gold text-void',
|
|
303
|
+
secondary: 'bg-paper text-lux border border-stroke',
|
|
304
|
+
ghost: 'text-lux hover:bg-paper-2',
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
const sizeClasses = {
|
|
308
|
+
sm: 'px-3 py-2 text-sm',
|
|
309
|
+
md: 'px-4 py-3 text-base',
|
|
310
|
+
lg: 'px-6 py-4 text-lg',
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
return (
|
|
314
|
+
<button
|
|
315
|
+
className={`
|
|
316
|
+
rounded-control font-semibold transition-all duration-200
|
|
317
|
+
${variantClasses[variant]} ${sizeClasses[size]}
|
|
318
|
+
`}
|
|
319
|
+
>
|
|
320
|
+
{children}
|
|
321
|
+
</button>
|
|
322
|
+
);
|
|
323
|
+
};
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Common Patterns
|
|
329
|
+
|
|
330
|
+
### Card Container:
|
|
331
|
+
|
|
332
|
+
```html
|
|
333
|
+
<div class="bg-paper p-6 rounded-card shadow-card border border-stroke">
|
|
334
|
+
<h3 class="na-h3">Card Title</h3>
|
|
335
|
+
<p class="text-clay">Card description</p>
|
|
336
|
+
</div>
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Form Field:
|
|
340
|
+
|
|
341
|
+
```html
|
|
342
|
+
<div class="na-field">
|
|
343
|
+
<label class="na-label">Field Label</label>
|
|
344
|
+
<input
|
|
345
|
+
class="na-input border border-stroke rounded-control p-3"
|
|
346
|
+
type="text"
|
|
347
|
+
/>
|
|
348
|
+
<p class="na-metadata mt-2">Help text</p>
|
|
349
|
+
</div>
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Button Group:
|
|
353
|
+
|
|
354
|
+
```html
|
|
355
|
+
<div class="flex gap-3">
|
|
356
|
+
<button class="bg-gold text-void px-4 py-3 rounded-control font-semibold">
|
|
357
|
+
Primary
|
|
358
|
+
</button>
|
|
359
|
+
<button class="bg-paper text-lux px-4 py-3 rounded-control border border-stroke">
|
|
360
|
+
Secondary
|
|
361
|
+
</button>
|
|
362
|
+
</div>
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Data Table:
|
|
366
|
+
|
|
367
|
+
```html
|
|
368
|
+
<table class="w-full">
|
|
369
|
+
<thead>
|
|
370
|
+
<tr class="bg-paper-2 border-b border-stroke">
|
|
371
|
+
<th class="na-label p-4">Column</th>
|
|
372
|
+
<th class="na-label p-4">Value</th>
|
|
373
|
+
</tr>
|
|
374
|
+
</thead>
|
|
375
|
+
<tbody>
|
|
376
|
+
<tr class="border-b border-stroke-soft hover:bg-paper-2">
|
|
377
|
+
<td class="p-4 text-lux">Row data</td>
|
|
378
|
+
<td class="p-4 na-data">$1,234.00</td>
|
|
379
|
+
</tr>
|
|
380
|
+
</tbody>
|
|
381
|
+
</table>
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## Troubleshooting
|
|
387
|
+
|
|
388
|
+
### Tokens not loading:
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
# Verify install
|
|
392
|
+
npm list @aibos/design-system
|
|
393
|
+
|
|
394
|
+
# Rebuild
|
|
395
|
+
npm run build
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Colors not applying:
|
|
399
|
+
|
|
400
|
+
```css
|
|
401
|
+
/* Ensure CSS is imported before custom styles */
|
|
402
|
+
@import '@aibos/design-system/style.css';
|
|
403
|
+
|
|
404
|
+
/* Then use tokens */
|
|
405
|
+
.element {
|
|
406
|
+
color: var(--color-lux); /* ✅ Works */
|
|
407
|
+
}
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
### Missing utilities:
|
|
411
|
+
|
|
412
|
+
Check [TOKEN_REFERENCE.md](TOKEN_REFERENCE.md) for available tokens.
|
|
413
|
+
|
|
414
|
+
Custom utilities available:
|
|
415
|
+
- `.na-h1` through `.na-h6` — Typography hierarchy
|
|
416
|
+
- `.na-data`, `.na-data-large` — Data display
|
|
417
|
+
- `.na-metadata`, `.na-metadata-small` — Metadata
|
|
418
|
+
- `.text-lux`, `.text-clay`, `.text-gold` — Colors
|
|
419
|
+
- `.bg-void`, `.bg-paper`, `.bg-paper-2` — Backgrounds
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Next Steps
|
|
424
|
+
|
|
425
|
+
1. **Read** [TOKEN_REFERENCE.md](TOKEN_REFERENCE.md) — Complete token catalog
|
|
426
|
+
2. **Review** [GOVERNANCE.md](GOVERNANCE.md) — Design system rules
|
|
427
|
+
3. **Copy** examples from [DESIGN_SYSTEM.md](../DESIGN_SYSTEM.md) — Full guide
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
**Package:** [@aibos/design-system](https://www.npmjs.com/package/@aibos/design-system)
|
|
432
|
+
**Last Updated:** 2025-01-24
|
|
433
|
+
**Support:** Check documentation or open an issue on GitHub
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
# 🎯 CLI Reactive HUD - Quick Reference Card
|
|
2
|
+
|
|
3
|
+
## Filter Syntax Cheat Sheet
|
|
4
|
+
|
|
5
|
+
### Basic Filters
|
|
6
|
+
```
|
|
7
|
+
status:healthy Single enum value
|
|
8
|
+
owner:patel String equality
|
|
9
|
+
revenue>100000 Numeric comparison
|
|
10
|
+
health>=80 Greater or equal
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Operators Reference
|
|
14
|
+
| Op | Meaning | Type | Example |
|
|
15
|
+
|----|---------|------|---------|
|
|
16
|
+
| `:` | Equals (default) | String/Enum | `status:healthy` |
|
|
17
|
+
| `=` | Equals | Any | `status=healthy` |
|
|
18
|
+
| `!=` | Not equal | Any | `status!=error` |
|
|
19
|
+
| `>` | Greater than | Number | `revenue>100000` |
|
|
20
|
+
| `<` | Less than | Number | `health<50` |
|
|
21
|
+
| `>=` | Greater/equal | Number | `health>=80` |
|
|
22
|
+
| `<=` | Less/equal | Number | `revenue<=250000` |
|
|
23
|
+
|
|
24
|
+
### Compound Filters (AND Logic)
|
|
25
|
+
```
|
|
26
|
+
status:healthy revenue>100000
|
|
27
|
+
→ Accounts with status="healthy" AND revenue > $100,000
|
|
28
|
+
|
|
29
|
+
status:healthy revenue>100000 health>=80
|
|
30
|
+
→ Accounts with ALL three conditions
|
|
31
|
+
|
|
32
|
+
status:watch owner:chen
|
|
33
|
+
→ Accounts with status="watch" AND owner="chen"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Available Filter Keys (25+)
|
|
39
|
+
|
|
40
|
+
### Account Info
|
|
41
|
+
- `account` - Account name
|
|
42
|
+
- `status` - Status (healthy, watch, error)
|
|
43
|
+
- `owner` - Owner name
|
|
44
|
+
- `priority` - Priority level
|
|
45
|
+
|
|
46
|
+
### Financial
|
|
47
|
+
- `revenue` - Annual revenue ($)
|
|
48
|
+
- `monthlyrev` - Monthly revenue
|
|
49
|
+
- `growth` - Growth rate (%)
|
|
50
|
+
|
|
51
|
+
### Health & Risk
|
|
52
|
+
- `health` - Health score (0-100)
|
|
53
|
+
- `score` - Overall score
|
|
54
|
+
- `riskLevel` - Risk classification
|
|
55
|
+
|
|
56
|
+
### Operational
|
|
57
|
+
- `region` - Geographic region
|
|
58
|
+
- `product` - Product category
|
|
59
|
+
- `team` - Assigned team
|
|
60
|
+
- `vol` - Volatility (low/medium/high)
|
|
61
|
+
|
|
62
|
+
### Status Categories
|
|
63
|
+
- `watch` - Watch list status
|
|
64
|
+
- `error` - Error flag status
|
|
65
|
+
- `critical` - Critical alerts
|
|
66
|
+
|
|
67
|
+
### Metrics
|
|
68
|
+
- `customMetric` - Custom data field
|
|
69
|
+
- `tags` - Tag classification
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## HUD Metrics Explained
|
|
74
|
+
|
|
75
|
+
### 📊 Governed Revenue
|
|
76
|
+
```
|
|
77
|
+
Total: Sum of all filtered account revenues
|
|
78
|
+
Example: $272,520 for 3 accounts
|
|
79
|
+
|
|
80
|
+
Average: Total ÷ count of filtered accounts
|
|
81
|
+
Example: $136,260 per account
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 💚 Avg Health
|
|
85
|
+
```
|
|
86
|
+
Score: Average health score (0-100%)
|
|
87
|
+
Example: 75%
|
|
88
|
+
|
|
89
|
+
Trend: ↗ Trending up (avg health > 80%)
|
|
90
|
+
→ Stable (50-80% health)
|
|
91
|
+
↘ Trending down (avg health < 50%)
|
|
92
|
+
|
|
93
|
+
Status: Distribution of status values
|
|
94
|
+
Example: "3 ↔ 1 accounts" = 3 healthy, 1 watch
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### ⚠️ Risk Level
|
|
98
|
+
```
|
|
99
|
+
LOW: Green badge - No watch/error accounts
|
|
100
|
+
MEDIUM: Yellow badge - Some risk indicators
|
|
101
|
+
HIGH: Orange badge - Multiple risk factors
|
|
102
|
+
CRITICAL: Red badge - Serious risk situation
|
|
103
|
+
|
|
104
|
+
Calculation:
|
|
105
|
+
watchCount = accounts with status='watch'
|
|
106
|
+
criticalCount = accounts with health < 40
|
|
107
|
+
riskScore = (watch × 0.5) + (critical × 0.3)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 📌 Accounts
|
|
111
|
+
```
|
|
112
|
+
Count: Number of matching records
|
|
113
|
+
Description: Summary text
|
|
114
|
+
"6 accounts analyzed. 75% avg health. ✓ Clean"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Keyboard Navigation
|
|
120
|
+
|
|
121
|
+
### In CLI Input
|
|
122
|
+
| Key | Action |
|
|
123
|
+
|-----|--------|
|
|
124
|
+
| Type | Enter filter query |
|
|
125
|
+
| Backspace | Delete character |
|
|
126
|
+
| Ctrl+A | Select all |
|
|
127
|
+
|
|
128
|
+
### In Autocomplete Menu (when visible)
|
|
129
|
+
| Key | Action |
|
|
130
|
+
|-----|--------|
|
|
131
|
+
| ↓ | Next suggestion |
|
|
132
|
+
| ↑ | Previous suggestion |
|
|
133
|
+
| Enter | Insert selected suggestion |
|
|
134
|
+
| Escape | Close menu |
|
|
135
|
+
| Backspace | Delete & re-suggest |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Test Scenarios
|
|
140
|
+
|
|
141
|
+
### Scenario 1: Basic Filter
|
|
142
|
+
**Query**: `status:healthy`
|
|
143
|
+
- Shows: 3 healthy accounts
|
|
144
|
+
- Revenue: $272,520 total, $90,840 average
|
|
145
|
+
- Health: 79% average with trend
|
|
146
|
+
- Risk: LOW (all healthy)
|
|
147
|
+
- Count: 3 accounts
|
|
148
|
+
|
|
149
|
+
### Scenario 2: Financial Filter
|
|
150
|
+
**Query**: `revenue>100000`
|
|
151
|
+
- Shows: 4 accounts with revenue > $100k
|
|
152
|
+
- Revenue: Very high totals
|
|
153
|
+
- Health: Mixed scores
|
|
154
|
+
- Risk: Depends on health
|
|
155
|
+
|
|
156
|
+
### Scenario 3: High-Risk
|
|
157
|
+
**Query**: `health<50`
|
|
158
|
+
- Shows: 2 high-risk accounts
|
|
159
|
+
- Revenue: Lower revenues
|
|
160
|
+
- Health: 39% average
|
|
161
|
+
- Risk: CRITICAL (low health)
|
|
162
|
+
|
|
163
|
+
### Scenario 4: Combined
|
|
164
|
+
**Query**: `status:healthy revenue>100000`
|
|
165
|
+
- Shows: Only 2 healthy accounts with high revenue
|
|
166
|
+
- Most optimal accounts by both metrics
|
|
167
|
+
- Health: 88% and 75%
|
|
168
|
+
- Risk: LOW
|
|
169
|
+
|
|
170
|
+
### Scenario 5: No Matches
|
|
171
|
+
**Query**: `status:error health>90`
|
|
172
|
+
- Shows: Empty state message
|
|
173
|
+
- HUD: Reset to defaults
|
|
174
|
+
- Table: No rows visible
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Integration Checklist
|
|
179
|
+
|
|
180
|
+
- [ ] Copy `lib/` folder to your project
|
|
181
|
+
- [ ] Add CLI imports to your module: `import { FilterEngine } from './lib/cli-filter-engine.ts'`
|
|
182
|
+
- [ ] Create filter input element with id `cli-input`
|
|
183
|
+
- [ ] Create HUD card elements (revenue, health, risk, count)
|
|
184
|
+
- [ ] Wire filter input to `updateTable()` function
|
|
185
|
+
- [ ] Bind `aggregateMetrics()` results to HUD DOM elements
|
|
186
|
+
- [ ] Test with sample data (minimum 6 rows recommended)
|
|
187
|
+
- [ ] Customize filter commands in `COMMAND_SCHEMA`
|
|
188
|
+
- [ ] Add custom metrics to `aggregateMetrics()`
|
|
189
|
+
- [ ] Style HUD cards with your brand colors
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Common Issues & Solutions
|
|
194
|
+
|
|
195
|
+
### Issue: Autocomplete not appearing
|
|
196
|
+
**Solution**: Make sure `li-cli-autocomplete.ts` is imported and autocomplete div exists in HTML
|
|
197
|
+
|
|
198
|
+
### Issue: Metrics showing $0 or 0%
|
|
199
|
+
**Solution**: Check that data attributes match command keys exactly (e.g., `data-revenue`, `data-health`)
|
|
200
|
+
|
|
201
|
+
### Issue: Filter not working
|
|
202
|
+
**Solution**: Verify command key exists in `COMMAND_SCHEMA` in `cli-commands.ts`
|
|
203
|
+
|
|
204
|
+
### Issue: Type errors in TypeScript
|
|
205
|
+
**Solution**: Ensure `ValidCommand` type is imported and used for all filter key references
|
|
206
|
+
|
|
207
|
+
### Issue: HUD not updating
|
|
208
|
+
**Solution**: Call `aggregateMetrics()` after `applyFilters()`, then update DOM elements
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Performance Tips
|
|
213
|
+
|
|
214
|
+
### For Small Datasets (< 100 rows)
|
|
215
|
+
- No optimization needed
|
|
216
|
+
- All operations < 5ms
|
|
217
|
+
- Real-time filtering safe
|
|
218
|
+
|
|
219
|
+
### For Medium Datasets (100-1000 rows)
|
|
220
|
+
- Consider debouncing input: `debounce(updateTable, 100ms)`
|
|
221
|
+
- Batch DOM updates
|
|
222
|
+
- Pre-calculate common metrics
|
|
223
|
+
|
|
224
|
+
### For Large Datasets (1000+ rows)
|
|
225
|
+
- Move filtering to server
|
|
226
|
+
- Use pagination (load first 100 rows)
|
|
227
|
+
- Cache aggregations
|
|
228
|
+
- Use Web Workers for calculations
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Customization Guide
|
|
233
|
+
|
|
234
|
+
### Add New Filter Command
|
|
235
|
+
```typescript
|
|
236
|
+
// In lib/cli-commands.ts
|
|
237
|
+
export const COMMAND_SCHEMA: Record<ValidCommand, CommandSchema> = {
|
|
238
|
+
// ...existing...
|
|
239
|
+
newfilter: {
|
|
240
|
+
description: 'My custom filter',
|
|
241
|
+
type: 'enum',
|
|
242
|
+
values: ['option1', 'option2'],
|
|
243
|
+
operators: ['=', '!=']
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Add to ValidCommand type
|
|
248
|
+
type ValidCommand = '...' | 'newfilter'
|
|
249
|
+
|
|
250
|
+
// In HTML table
|
|
251
|
+
<tr data-newfilter="option1">
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Add New HUD Metric
|
|
255
|
+
```javascript
|
|
256
|
+
// In FilterEngine.aggregateMetrics()
|
|
257
|
+
return {
|
|
258
|
+
...existing,
|
|
259
|
+
customMetric: {
|
|
260
|
+
value: calculateCustomValue(rows),
|
|
261
|
+
label: 'Custom Metric'
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// In HTML
|
|
266
|
+
<div class="hud-card">
|
|
267
|
+
<div class="hud-card-label">🎯 Custom</div>
|
|
268
|
+
<div class="hud-card-value" id="hud-custom">0</div>
|
|
269
|
+
</div>
|
|
270
|
+
|
|
271
|
+
// In updateTable()
|
|
272
|
+
hudCustom.textContent = metrics.customMetric.value;
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Browser Support
|
|
278
|
+
|
|
279
|
+
- ✅ Chrome/Edge (latest 2 versions)
|
|
280
|
+
- ✅ Firefox (latest 2 versions)
|
|
281
|
+
- ✅ Safari (latest 2 versions)
|
|
282
|
+
- ✅ Mobile browsers (iOS Safari, Chrome Mobile)
|
|
283
|
+
|
|
284
|
+
**Requires**:
|
|
285
|
+
- ES2020+ support (optional chaining, nullish coalescing)
|
|
286
|
+
- CSS Grid & Flexbox
|
|
287
|
+
- Intl.NumberFormat API
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## Related Documentation
|
|
292
|
+
|
|
293
|
+
- 📖 [Complete Guide](CLI_REACTIVE_HUD_COMPLETE_GUIDE.md)
|
|
294
|
+
- 🔧 [Integration Guide](INTEGRATION_GUIDE.md)
|
|
295
|
+
- 📋 [Command Reference](CLI_FILTER_COMMANDS.md)
|
|
296
|
+
- 🤖 [Autocomplete Deep Dive](CLI_AUTOCOMPLETE_ENGINE.md)
|
|
297
|
+
- ✅ [Status Report](CLI_REACTIVE_HUD_FINAL_STATUS.md)
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
**Version**: 1.0
|
|
302
|
+
**Last Updated**: December 29, 2025
|
|
303
|
+
**Status**: Production Ready ✅
|