@exaudeus/workrail 0.6.1-beta.8 → 0.7.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/dist/application/services/workflow-service.js +41 -11
- package/dist/cli.js +44 -0
- package/dist/config/feature-flags.d.ts +33 -0
- package/dist/config/feature-flags.js +106 -0
- package/dist/container.d.ts +2 -0
- package/dist/container.js +3 -0
- package/dist/mcp-server.js +31 -6
- package/package.json +1 -1
- package/web/assets/images/favicon-amber-16.png +0 -0
- package/web/assets/images/favicon-amber-32.png +0 -0
- package/web/assets/images/favicon-white-16-clean.png +0 -0
- package/web/assets/images/favicon-white-32-clean.png +0 -0
- package/web/assets/images/icon-amber-192.png +0 -0
- package/web/assets/images/icon-amber-512.png +0 -0
- package/web/assets/images/icon-amber.svg +27 -0
- package/web/assets/images/icon-white-192-clean.png +0 -0
- package/web/assets/images/icon-white-512-clean.png +0 -0
- package/web/assets/images/icon-white.svg +27 -0
- package/web/manifest.json +1 -1
- package/workflows/CHANGELOG-bug-investigation.md +167 -85
- package/workflows/documentation-update-workflow.json +334 -345
- package/workflows/examples/dashboard-template-workflow.json +176 -0
- package/workflows/systematic-bug-investigation-with-loops.backup-20251106-125543.json +751 -0
- package/workflows/systematic-bug-investigation-with-loops.json +727 -664
- package/web/ADAPTIVE_BACKGROUND_SYSTEM.md +0 -523
- package/web/BACKGROUND_ENHANCEMENTS.md +0 -419
- package/web/COMPONENT_LIBRARY.md +0 -755
- package/web/COMPONENT_MIGRATION_GUIDE.md +0 -537
- package/web/assets/images/favicon-white-16.png +0 -0
- package/web/assets/images/favicon-white-32.png +0 -0
- package/web/assets/images/icon-white-192.png +0 -0
- package/web/assets/images/icon-white-512.png +0 -0
- package/web/assets/images/icon-white.png +0 -0
- package/workflows/dashboard-template-workflow.json +0 -337
- package/workflows/deep-documentation-workflow.json +0 -0
- package/workflows/systemic-bug-investigation-with-loops.json +0 -645
package/web/COMPONENT_LIBRARY.md
DELETED
|
@@ -1,755 +0,0 @@
|
|
|
1
|
-
# Workrail Component Library
|
|
2
|
-
|
|
3
|
-
**Like Jetpack Compose for the Web** - Define components once, use them everywhere with guaranteed design system compliance.
|
|
4
|
-
|
|
5
|
-
## 📦 Installation
|
|
6
|
-
|
|
7
|
-
Include the component library in your HTML:
|
|
8
|
-
|
|
9
|
-
```html
|
|
10
|
-
<!-- After design system CSS -->
|
|
11
|
-
<link rel="stylesheet" href="/assets/design-system.css">
|
|
12
|
-
<link rel="stylesheet" href="/assets/components.css">
|
|
13
|
-
<link rel="stylesheet" href="/assets/animations.css">
|
|
14
|
-
|
|
15
|
-
<!-- Component library JS -->
|
|
16
|
-
<script src="/assets/components.js"></script>
|
|
17
|
-
|
|
18
|
-
<!-- Lucide icons (required for icons) -->
|
|
19
|
-
<script src="https://unpkg.com/lucide@latest"></script>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## 🎯 Philosophy
|
|
23
|
-
|
|
24
|
-
### **Before (Manual HTML)**
|
|
25
|
-
```html
|
|
26
|
-
<!-- Inconsistent, error-prone, hard to maintain -->
|
|
27
|
-
<div class="card card-glass" style="border-left-color: #8b5cf6;">
|
|
28
|
-
<h3 style="font-size: var(--text-lg); margin-bottom: var(--space-4);">Title</h3>
|
|
29
|
-
<p style="color: var(--text-secondary);">Content</p>
|
|
30
|
-
</div>
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### **After (Component Library)**
|
|
34
|
-
```javascript
|
|
35
|
-
// Consistent, type-safe, automatically follows design system
|
|
36
|
-
const card = WorkrailComponents.Card({
|
|
37
|
-
title: "Title",
|
|
38
|
-
content: "Content",
|
|
39
|
-
variant: "glass",
|
|
40
|
-
borderColor: "var(--accent-purple)"
|
|
41
|
-
});
|
|
42
|
-
document.getElementById('container').appendChild(card);
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## 📚 Components
|
|
46
|
-
|
|
47
|
-
### 1. Button
|
|
48
|
-
|
|
49
|
-
```javascript
|
|
50
|
-
const button = WorkrailComponents.Button({
|
|
51
|
-
text: "Click Me",
|
|
52
|
-
icon: "rocket", // Lucide icon name
|
|
53
|
-
variant: "primary", // primary|secondary|ghost|danger|glass
|
|
54
|
-
size: "md", // sm|md|lg
|
|
55
|
-
spring: true, // Add spring animation
|
|
56
|
-
disabled: false,
|
|
57
|
-
onClick: () => console.log('Clicked!')
|
|
58
|
-
});
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
**Variants:**
|
|
62
|
-
- `primary` - Bold primary action
|
|
63
|
-
- `secondary` - Secondary action with border
|
|
64
|
-
- `ghost` - Transparent, minimal
|
|
65
|
-
- `danger` - Destructive action (red)
|
|
66
|
-
- `glass` - Glassmorphism effect
|
|
67
|
-
|
|
68
|
-
### 2. Card
|
|
69
|
-
|
|
70
|
-
```javascript
|
|
71
|
-
const card = WorkrailComponents.Card({
|
|
72
|
-
title: "Card Title",
|
|
73
|
-
content: "Card content text or HTML element",
|
|
74
|
-
footer: "Optional footer",
|
|
75
|
-
variant: "glass", // default|glass|float|workflow
|
|
76
|
-
borderColor: "var(--accent-cyan)",
|
|
77
|
-
animate: true, // Entrance animation
|
|
78
|
-
onClick: () => console.log('Card clicked!')
|
|
79
|
-
});
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
**Variants:**
|
|
83
|
-
- `default` - Standard card
|
|
84
|
-
- `glass` - Glassmorphism with blur
|
|
85
|
-
- `float` - Floating animation
|
|
86
|
-
- `workflow` - Workflow-themed with colored border
|
|
87
|
-
|
|
88
|
-
### 3. Session Card (Specialized)
|
|
89
|
-
|
|
90
|
-
```javascript
|
|
91
|
-
const sessionCard = WorkrailComponents.SessionCard({
|
|
92
|
-
sessionId: "DASH-001",
|
|
93
|
-
title: "Session description",
|
|
94
|
-
status: "in_progress", // in_progress|complete
|
|
95
|
-
progress: 75, // 0-100
|
|
96
|
-
confidence: 8.5, // 0-10
|
|
97
|
-
phase: "Phase 3",
|
|
98
|
-
updated: "2 minutes ago",
|
|
99
|
-
borderColor: "var(--accent-purple)",
|
|
100
|
-
onClick: () => navigateToSession('DASH-001'),
|
|
101
|
-
onDelete: (id) => deleteSession(id)
|
|
102
|
-
});
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### 4. Status Badge
|
|
106
|
-
|
|
107
|
-
```javascript
|
|
108
|
-
const badge = WorkrailComponents.StatusBadge({
|
|
109
|
-
status: "success", // success|active|pending|error|info
|
|
110
|
-
text: "COMPLETE",
|
|
111
|
-
glow: true // Add glow effect
|
|
112
|
-
});
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### 5. Hero Section
|
|
116
|
-
|
|
117
|
-
```javascript
|
|
118
|
-
const hero = WorkrailComponents.Hero({
|
|
119
|
-
title: "Workrail Dashboard",
|
|
120
|
-
subtitle: "Real-time workflow tracking",
|
|
121
|
-
icon: "rocket", // Lucide icon
|
|
122
|
-
gradient: "linear-gradient(135deg, #667eea, #764ba2)"
|
|
123
|
-
});
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### 6. Stat Card
|
|
127
|
-
|
|
128
|
-
```javascript
|
|
129
|
-
const statCard = WorkrailComponents.StatCard({
|
|
130
|
-
value: 24,
|
|
131
|
-
label: "Active Sessions",
|
|
132
|
-
icon: "bar-chart-3",
|
|
133
|
-
color: "#06b6d4",
|
|
134
|
-
gradient: true, // Use gradient background
|
|
135
|
-
float: true // Add floating animation
|
|
136
|
-
});
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### 7. Progress Ring
|
|
140
|
-
|
|
141
|
-
```javascript
|
|
142
|
-
const progressRing = WorkrailComponents.ProgressRing({
|
|
143
|
-
progress: 75, // 0-100
|
|
144
|
-
size: 120, // Diameter in pixels
|
|
145
|
-
strokeWidth: 8,
|
|
146
|
-
color: "var(--primary-500)",
|
|
147
|
-
showPercentage: true
|
|
148
|
-
});
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### 8. Modal
|
|
152
|
-
|
|
153
|
-
```javascript
|
|
154
|
-
const modal = WorkrailComponents.Modal({
|
|
155
|
-
title: "Confirm Delete",
|
|
156
|
-
content: "Are you sure you want to delete this session?",
|
|
157
|
-
actions: [
|
|
158
|
-
{
|
|
159
|
-
text: "Cancel",
|
|
160
|
-
variant: "secondary",
|
|
161
|
-
onClick: () => modal.hide()
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
text: "Delete",
|
|
165
|
-
variant: "danger",
|
|
166
|
-
onClick: () => {
|
|
167
|
-
performDelete();
|
|
168
|
-
modal.hide();
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
],
|
|
172
|
-
onClose: () => console.log('Modal closed')
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
// Show the modal
|
|
176
|
-
modal.show();
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
## 🎨 Complete Example
|
|
180
|
-
|
|
181
|
-
```javascript
|
|
182
|
-
// Create a session card
|
|
183
|
-
const card = WorkrailComponents.SessionCard({
|
|
184
|
-
sessionId: "BUG-042",
|
|
185
|
-
title: "Authentication token expiration issue",
|
|
186
|
-
status: "in_progress",
|
|
187
|
-
progress: 60,
|
|
188
|
-
confidence: 7.5,
|
|
189
|
-
phase: "Phase 2",
|
|
190
|
-
updated: "5 minutes ago",
|
|
191
|
-
borderColor: "var(--accent-cyan)",
|
|
192
|
-
onClick: () => window.location.href = `/dashboard?session=BUG-042`,
|
|
193
|
-
onDelete: async (id) => {
|
|
194
|
-
const modal = WorkrailComponents.Modal({
|
|
195
|
-
title: "Delete Session",
|
|
196
|
-
content: `Delete ${id}? This cannot be undone.`,
|
|
197
|
-
actions: [
|
|
198
|
-
{ text: "Cancel", variant: "secondary", onClick: () => modal.hide() },
|
|
199
|
-
{ text: "Delete", variant: "danger", onClick: async () => {
|
|
200
|
-
await fetch(`/api/sessions/${id}`, { method: 'DELETE' });
|
|
201
|
-
card.remove();
|
|
202
|
-
modal.hide();
|
|
203
|
-
}}
|
|
204
|
-
]
|
|
205
|
-
});
|
|
206
|
-
modal.show();
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
// Add to page
|
|
211
|
-
document.getElementById('sessions-grid').appendChild(card);
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
## 🔄 Migrating Existing Code
|
|
215
|
-
|
|
216
|
-
### Before (Manual HTML):
|
|
217
|
-
```javascript
|
|
218
|
-
async function loadSessions() {
|
|
219
|
-
const sessions = await fetch('/api/sessions').then(r => r.json());
|
|
220
|
-
const grid = document.getElementById('sessions-grid');
|
|
221
|
-
|
|
222
|
-
sessions.forEach(session => {
|
|
223
|
-
const card = document.createElement('div');
|
|
224
|
-
card.className = 'session-card';
|
|
225
|
-
card.innerHTML = `
|
|
226
|
-
<div class="session-header">
|
|
227
|
-
<span class="session-id">${session.id}</span>
|
|
228
|
-
<span class="session-status status-${session.status}">${session.status}</span>
|
|
229
|
-
</div>
|
|
230
|
-
<div class="session-title">${session.title}</div>
|
|
231
|
-
<!-- ...more manual HTML... -->
|
|
232
|
-
`;
|
|
233
|
-
grid.appendChild(card);
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
### After (Component Library):
|
|
239
|
-
```javascript
|
|
240
|
-
async function loadSessions() {
|
|
241
|
-
const sessions = await fetch('/api/sessions').then(r => r.json());
|
|
242
|
-
const grid = document.getElementById('sessions-grid');
|
|
243
|
-
|
|
244
|
-
sessions.forEach(session => {
|
|
245
|
-
const card = WorkrailComponents.SessionCard({
|
|
246
|
-
sessionId: session.id,
|
|
247
|
-
title: session.title,
|
|
248
|
-
status: session.status,
|
|
249
|
-
progress: session.progress,
|
|
250
|
-
confidence: session.confidence,
|
|
251
|
-
phase: session.phase,
|
|
252
|
-
updated: session.updated,
|
|
253
|
-
borderColor: getBorderColor(session),
|
|
254
|
-
onClick: () => openSession(session.id),
|
|
255
|
-
onDelete: (id) => deleteSession(id)
|
|
256
|
-
});
|
|
257
|
-
grid.appendChild(card);
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
## ✅ Benefits
|
|
263
|
-
|
|
264
|
-
1. **Design System Compliance** - Components automatically use design tokens
|
|
265
|
-
2. **Type Safety** - Clear parameter contracts
|
|
266
|
-
3. **Consistency** - Same component looks identical everywhere
|
|
267
|
-
4. **Maintainability** - Fix once, applies everywhere
|
|
268
|
-
5. **Developer Experience** - Cleaner, more readable code
|
|
269
|
-
6. **Performance** - No HTML parsing, direct DOM creation
|
|
270
|
-
7. **Testability** - Components can be unit tested
|
|
271
|
-
|
|
272
|
-
## 🚀 Advanced Usage
|
|
273
|
-
|
|
274
|
-
### Custom Styling
|
|
275
|
-
|
|
276
|
-
Components accept inline styles for customization:
|
|
277
|
-
|
|
278
|
-
```javascript
|
|
279
|
-
const card = WorkrailComponents.Card({
|
|
280
|
-
title: "Custom Card",
|
|
281
|
-
content: "Content",
|
|
282
|
-
borderColor: "var(--accent-pink)"
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
// Add custom styles if needed
|
|
286
|
-
card.style.maxWidth = "400px";
|
|
287
|
-
card.dataset.workflowType = "bug-investigation";
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
### Composition
|
|
291
|
-
|
|
292
|
-
Components can be nested:
|
|
293
|
-
|
|
294
|
-
```javascript
|
|
295
|
-
const cardContent = createElement('div', [], {}, [
|
|
296
|
-
WorkrailComponents.StatCard({ value: 100, label: "Complete" }),
|
|
297
|
-
WorkrailComponents.Button({ text: "View Details", variant: "primary" })
|
|
298
|
-
]);
|
|
299
|
-
|
|
300
|
-
const card = WorkrailComponents.Card({
|
|
301
|
-
title: "Statistics",
|
|
302
|
-
content: cardContent,
|
|
303
|
-
variant: "glass"
|
|
304
|
-
});
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
### Event Handling
|
|
308
|
-
|
|
309
|
-
All click handlers receive the event object:
|
|
310
|
-
|
|
311
|
-
```javascript
|
|
312
|
-
const button = WorkrailComponents.Button({
|
|
313
|
-
text: "Save",
|
|
314
|
-
onClick: (event) => {
|
|
315
|
-
event.stopPropagation();
|
|
316
|
-
console.log('Button clicked, not bubbling');
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
## 📝 Adding New Components
|
|
322
|
-
|
|
323
|
-
To add a new component to the library:
|
|
324
|
-
|
|
325
|
-
1. Follow the existing pattern in `components.js`
|
|
326
|
-
2. Use `createElement` helper for consistency
|
|
327
|
-
3. Accept a config object with sensible defaults
|
|
328
|
-
4. Return a DOM element
|
|
329
|
-
5. Document it in this file
|
|
330
|
-
|
|
331
|
-
Example:
|
|
332
|
-
|
|
333
|
-
```javascript
|
|
334
|
-
/**
|
|
335
|
-
* Badge Component
|
|
336
|
-
* @param {Object} config
|
|
337
|
-
* @param {string} config.text - Badge text
|
|
338
|
-
* @param {string} config.variant - success|warning|error
|
|
339
|
-
*/
|
|
340
|
-
WorkrailComponents.Badge = function(config) {
|
|
341
|
-
const { text, variant = 'info' } = config;
|
|
342
|
-
return createElement('span', ['badge', `badge-${variant}`], {}, [text]);
|
|
343
|
-
};
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
## 🎯 Migration Checklist
|
|
347
|
-
|
|
348
|
-
- [ ] Include `components.js` in all HTML pages
|
|
349
|
-
- [ ] Replace manual session card creation with `SessionCard` component
|
|
350
|
-
- [ ] Replace button HTML with `Button` component
|
|
351
|
-
- [ ] Replace modal HTML with `Modal` component
|
|
352
|
-
- [ ] Replace hero sections with `Hero` component
|
|
353
|
-
- [ ] Test all interactive features
|
|
354
|
-
- [ ] Verify design system compliance
|
|
355
|
-
- [ ] Remove redundant inline styles
|
|
356
|
-
|
|
357
|
-
## 🐛 Troubleshooting
|
|
358
|
-
|
|
359
|
-
**Icons not showing?**
|
|
360
|
-
- Ensure Lucide is loaded: `<script src="https://unpkg.com/lucide@latest"></script>`
|
|
361
|
-
- Icons are initialized automatically, but you can manually trigger: `lucide.createIcons()`
|
|
362
|
-
|
|
363
|
-
**Styles not applied?**
|
|
364
|
-
- Ensure CSS is loaded before `components.js`
|
|
365
|
-
- Check that design system CSS is included
|
|
366
|
-
|
|
367
|
-
**Components not found?**
|
|
368
|
-
- Check console for `[Workrail Components] Library loaded`
|
|
369
|
-
- Ensure `components.js` loads without errors
|
|
370
|
-
|
|
371
|
-
---
|
|
372
|
-
|
|
373
|
-
**Version**: 1.0.0
|
|
374
|
-
**Last Updated**: October 2, 2025
|
|
375
|
-
**Maintained By**: Workrail Team
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
**Like Jetpack Compose for the Web** - Define components once, use them everywhere with guaranteed design system compliance.
|
|
381
|
-
|
|
382
|
-
## 📦 Installation
|
|
383
|
-
|
|
384
|
-
Include the component library in your HTML:
|
|
385
|
-
|
|
386
|
-
```html
|
|
387
|
-
<!-- After design system CSS -->
|
|
388
|
-
<link rel="stylesheet" href="/assets/design-system.css">
|
|
389
|
-
<link rel="stylesheet" href="/assets/components.css">
|
|
390
|
-
<link rel="stylesheet" href="/assets/animations.css">
|
|
391
|
-
|
|
392
|
-
<!-- Component library JS -->
|
|
393
|
-
<script src="/assets/components.js"></script>
|
|
394
|
-
|
|
395
|
-
<!-- Lucide icons (required for icons) -->
|
|
396
|
-
<script src="https://unpkg.com/lucide@latest"></script>
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
## 🎯 Philosophy
|
|
400
|
-
|
|
401
|
-
### **Before (Manual HTML)**
|
|
402
|
-
```html
|
|
403
|
-
<!-- Inconsistent, error-prone, hard to maintain -->
|
|
404
|
-
<div class="card card-glass" style="border-left-color: #8b5cf6;">
|
|
405
|
-
<h3 style="font-size: var(--text-lg); margin-bottom: var(--space-4);">Title</h3>
|
|
406
|
-
<p style="color: var(--text-secondary);">Content</p>
|
|
407
|
-
</div>
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
### **After (Component Library)**
|
|
411
|
-
```javascript
|
|
412
|
-
// Consistent, type-safe, automatically follows design system
|
|
413
|
-
const card = WorkrailComponents.Card({
|
|
414
|
-
title: "Title",
|
|
415
|
-
content: "Content",
|
|
416
|
-
variant: "glass",
|
|
417
|
-
borderColor: "var(--accent-purple)"
|
|
418
|
-
});
|
|
419
|
-
document.getElementById('container').appendChild(card);
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
## 📚 Components
|
|
423
|
-
|
|
424
|
-
### 1. Button
|
|
425
|
-
|
|
426
|
-
```javascript
|
|
427
|
-
const button = WorkrailComponents.Button({
|
|
428
|
-
text: "Click Me",
|
|
429
|
-
icon: "rocket", // Lucide icon name
|
|
430
|
-
variant: "primary", // primary|secondary|ghost|danger|glass
|
|
431
|
-
size: "md", // sm|md|lg
|
|
432
|
-
spring: true, // Add spring animation
|
|
433
|
-
disabled: false,
|
|
434
|
-
onClick: () => console.log('Clicked!')
|
|
435
|
-
});
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
**Variants:**
|
|
439
|
-
- `primary` - Bold primary action
|
|
440
|
-
- `secondary` - Secondary action with border
|
|
441
|
-
- `ghost` - Transparent, minimal
|
|
442
|
-
- `danger` - Destructive action (red)
|
|
443
|
-
- `glass` - Glassmorphism effect
|
|
444
|
-
|
|
445
|
-
### 2. Card
|
|
446
|
-
|
|
447
|
-
```javascript
|
|
448
|
-
const card = WorkrailComponents.Card({
|
|
449
|
-
title: "Card Title",
|
|
450
|
-
content: "Card content text or HTML element",
|
|
451
|
-
footer: "Optional footer",
|
|
452
|
-
variant: "glass", // default|glass|float|workflow
|
|
453
|
-
borderColor: "var(--accent-cyan)",
|
|
454
|
-
animate: true, // Entrance animation
|
|
455
|
-
onClick: () => console.log('Card clicked!')
|
|
456
|
-
});
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
**Variants:**
|
|
460
|
-
- `default` - Standard card
|
|
461
|
-
- `glass` - Glassmorphism with blur
|
|
462
|
-
- `float` - Floating animation
|
|
463
|
-
- `workflow` - Workflow-themed with colored border
|
|
464
|
-
|
|
465
|
-
### 3. Session Card (Specialized)
|
|
466
|
-
|
|
467
|
-
```javascript
|
|
468
|
-
const sessionCard = WorkrailComponents.SessionCard({
|
|
469
|
-
sessionId: "DASH-001",
|
|
470
|
-
title: "Session description",
|
|
471
|
-
status: "in_progress", // in_progress|complete
|
|
472
|
-
progress: 75, // 0-100
|
|
473
|
-
confidence: 8.5, // 0-10
|
|
474
|
-
phase: "Phase 3",
|
|
475
|
-
updated: "2 minutes ago",
|
|
476
|
-
borderColor: "var(--accent-purple)",
|
|
477
|
-
onClick: () => navigateToSession('DASH-001'),
|
|
478
|
-
onDelete: (id) => deleteSession(id)
|
|
479
|
-
});
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
### 4. Status Badge
|
|
483
|
-
|
|
484
|
-
```javascript
|
|
485
|
-
const badge = WorkrailComponents.StatusBadge({
|
|
486
|
-
status: "success", // success|active|pending|error|info
|
|
487
|
-
text: "COMPLETE",
|
|
488
|
-
glow: true // Add glow effect
|
|
489
|
-
});
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
### 5. Hero Section
|
|
493
|
-
|
|
494
|
-
```javascript
|
|
495
|
-
const hero = WorkrailComponents.Hero({
|
|
496
|
-
title: "Workrail Dashboard",
|
|
497
|
-
subtitle: "Real-time workflow tracking",
|
|
498
|
-
icon: "rocket", // Lucide icon
|
|
499
|
-
gradient: "linear-gradient(135deg, #667eea, #764ba2)"
|
|
500
|
-
});
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
### 6. Stat Card
|
|
504
|
-
|
|
505
|
-
```javascript
|
|
506
|
-
const statCard = WorkrailComponents.StatCard({
|
|
507
|
-
value: 24,
|
|
508
|
-
label: "Active Sessions",
|
|
509
|
-
icon: "bar-chart-3",
|
|
510
|
-
color: "#06b6d4",
|
|
511
|
-
gradient: true, // Use gradient background
|
|
512
|
-
float: true // Add floating animation
|
|
513
|
-
});
|
|
514
|
-
```
|
|
515
|
-
|
|
516
|
-
### 7. Progress Ring
|
|
517
|
-
|
|
518
|
-
```javascript
|
|
519
|
-
const progressRing = WorkrailComponents.ProgressRing({
|
|
520
|
-
progress: 75, // 0-100
|
|
521
|
-
size: 120, // Diameter in pixels
|
|
522
|
-
strokeWidth: 8,
|
|
523
|
-
color: "var(--primary-500)",
|
|
524
|
-
showPercentage: true
|
|
525
|
-
});
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
### 8. Modal
|
|
529
|
-
|
|
530
|
-
```javascript
|
|
531
|
-
const modal = WorkrailComponents.Modal({
|
|
532
|
-
title: "Confirm Delete",
|
|
533
|
-
content: "Are you sure you want to delete this session?",
|
|
534
|
-
actions: [
|
|
535
|
-
{
|
|
536
|
-
text: "Cancel",
|
|
537
|
-
variant: "secondary",
|
|
538
|
-
onClick: () => modal.hide()
|
|
539
|
-
},
|
|
540
|
-
{
|
|
541
|
-
text: "Delete",
|
|
542
|
-
variant: "danger",
|
|
543
|
-
onClick: () => {
|
|
544
|
-
performDelete();
|
|
545
|
-
modal.hide();
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
],
|
|
549
|
-
onClose: () => console.log('Modal closed')
|
|
550
|
-
});
|
|
551
|
-
|
|
552
|
-
// Show the modal
|
|
553
|
-
modal.show();
|
|
554
|
-
```
|
|
555
|
-
|
|
556
|
-
## 🎨 Complete Example
|
|
557
|
-
|
|
558
|
-
```javascript
|
|
559
|
-
// Create a session card
|
|
560
|
-
const card = WorkrailComponents.SessionCard({
|
|
561
|
-
sessionId: "BUG-042",
|
|
562
|
-
title: "Authentication token expiration issue",
|
|
563
|
-
status: "in_progress",
|
|
564
|
-
progress: 60,
|
|
565
|
-
confidence: 7.5,
|
|
566
|
-
phase: "Phase 2",
|
|
567
|
-
updated: "5 minutes ago",
|
|
568
|
-
borderColor: "var(--accent-cyan)",
|
|
569
|
-
onClick: () => window.location.href = `/dashboard?session=BUG-042`,
|
|
570
|
-
onDelete: async (id) => {
|
|
571
|
-
const modal = WorkrailComponents.Modal({
|
|
572
|
-
title: "Delete Session",
|
|
573
|
-
content: `Delete ${id}? This cannot be undone.`,
|
|
574
|
-
actions: [
|
|
575
|
-
{ text: "Cancel", variant: "secondary", onClick: () => modal.hide() },
|
|
576
|
-
{ text: "Delete", variant: "danger", onClick: async () => {
|
|
577
|
-
await fetch(`/api/sessions/${id}`, { method: 'DELETE' });
|
|
578
|
-
card.remove();
|
|
579
|
-
modal.hide();
|
|
580
|
-
}}
|
|
581
|
-
]
|
|
582
|
-
});
|
|
583
|
-
modal.show();
|
|
584
|
-
}
|
|
585
|
-
});
|
|
586
|
-
|
|
587
|
-
// Add to page
|
|
588
|
-
document.getElementById('sessions-grid').appendChild(card);
|
|
589
|
-
```
|
|
590
|
-
|
|
591
|
-
## 🔄 Migrating Existing Code
|
|
592
|
-
|
|
593
|
-
### Before (Manual HTML):
|
|
594
|
-
```javascript
|
|
595
|
-
async function loadSessions() {
|
|
596
|
-
const sessions = await fetch('/api/sessions').then(r => r.json());
|
|
597
|
-
const grid = document.getElementById('sessions-grid');
|
|
598
|
-
|
|
599
|
-
sessions.forEach(session => {
|
|
600
|
-
const card = document.createElement('div');
|
|
601
|
-
card.className = 'session-card';
|
|
602
|
-
card.innerHTML = `
|
|
603
|
-
<div class="session-header">
|
|
604
|
-
<span class="session-id">${session.id}</span>
|
|
605
|
-
<span class="session-status status-${session.status}">${session.status}</span>
|
|
606
|
-
</div>
|
|
607
|
-
<div class="session-title">${session.title}</div>
|
|
608
|
-
<!-- ...more manual HTML... -->
|
|
609
|
-
`;
|
|
610
|
-
grid.appendChild(card);
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
```
|
|
614
|
-
|
|
615
|
-
### After (Component Library):
|
|
616
|
-
```javascript
|
|
617
|
-
async function loadSessions() {
|
|
618
|
-
const sessions = await fetch('/api/sessions').then(r => r.json());
|
|
619
|
-
const grid = document.getElementById('sessions-grid');
|
|
620
|
-
|
|
621
|
-
sessions.forEach(session => {
|
|
622
|
-
const card = WorkrailComponents.SessionCard({
|
|
623
|
-
sessionId: session.id,
|
|
624
|
-
title: session.title,
|
|
625
|
-
status: session.status,
|
|
626
|
-
progress: session.progress,
|
|
627
|
-
confidence: session.confidence,
|
|
628
|
-
phase: session.phase,
|
|
629
|
-
updated: session.updated,
|
|
630
|
-
borderColor: getBorderColor(session),
|
|
631
|
-
onClick: () => openSession(session.id),
|
|
632
|
-
onDelete: (id) => deleteSession(id)
|
|
633
|
-
});
|
|
634
|
-
grid.appendChild(card);
|
|
635
|
-
});
|
|
636
|
-
}
|
|
637
|
-
```
|
|
638
|
-
|
|
639
|
-
## ✅ Benefits
|
|
640
|
-
|
|
641
|
-
1. **Design System Compliance** - Components automatically use design tokens
|
|
642
|
-
2. **Type Safety** - Clear parameter contracts
|
|
643
|
-
3. **Consistency** - Same component looks identical everywhere
|
|
644
|
-
4. **Maintainability** - Fix once, applies everywhere
|
|
645
|
-
5. **Developer Experience** - Cleaner, more readable code
|
|
646
|
-
6. **Performance** - No HTML parsing, direct DOM creation
|
|
647
|
-
7. **Testability** - Components can be unit tested
|
|
648
|
-
|
|
649
|
-
## 🚀 Advanced Usage
|
|
650
|
-
|
|
651
|
-
### Custom Styling
|
|
652
|
-
|
|
653
|
-
Components accept inline styles for customization:
|
|
654
|
-
|
|
655
|
-
```javascript
|
|
656
|
-
const card = WorkrailComponents.Card({
|
|
657
|
-
title: "Custom Card",
|
|
658
|
-
content: "Content",
|
|
659
|
-
borderColor: "var(--accent-pink)"
|
|
660
|
-
});
|
|
661
|
-
|
|
662
|
-
// Add custom styles if needed
|
|
663
|
-
card.style.maxWidth = "400px";
|
|
664
|
-
card.dataset.workflowType = "bug-investigation";
|
|
665
|
-
```
|
|
666
|
-
|
|
667
|
-
### Composition
|
|
668
|
-
|
|
669
|
-
Components can be nested:
|
|
670
|
-
|
|
671
|
-
```javascript
|
|
672
|
-
const cardContent = createElement('div', [], {}, [
|
|
673
|
-
WorkrailComponents.StatCard({ value: 100, label: "Complete" }),
|
|
674
|
-
WorkrailComponents.Button({ text: "View Details", variant: "primary" })
|
|
675
|
-
]);
|
|
676
|
-
|
|
677
|
-
const card = WorkrailComponents.Card({
|
|
678
|
-
title: "Statistics",
|
|
679
|
-
content: cardContent,
|
|
680
|
-
variant: "glass"
|
|
681
|
-
});
|
|
682
|
-
```
|
|
683
|
-
|
|
684
|
-
### Event Handling
|
|
685
|
-
|
|
686
|
-
All click handlers receive the event object:
|
|
687
|
-
|
|
688
|
-
```javascript
|
|
689
|
-
const button = WorkrailComponents.Button({
|
|
690
|
-
text: "Save",
|
|
691
|
-
onClick: (event) => {
|
|
692
|
-
event.stopPropagation();
|
|
693
|
-
console.log('Button clicked, not bubbling');
|
|
694
|
-
}
|
|
695
|
-
});
|
|
696
|
-
```
|
|
697
|
-
|
|
698
|
-
## 📝 Adding New Components
|
|
699
|
-
|
|
700
|
-
To add a new component to the library:
|
|
701
|
-
|
|
702
|
-
1. Follow the existing pattern in `components.js`
|
|
703
|
-
2. Use `createElement` helper for consistency
|
|
704
|
-
3. Accept a config object with sensible defaults
|
|
705
|
-
4. Return a DOM element
|
|
706
|
-
5. Document it in this file
|
|
707
|
-
|
|
708
|
-
Example:
|
|
709
|
-
|
|
710
|
-
```javascript
|
|
711
|
-
/**
|
|
712
|
-
* Badge Component
|
|
713
|
-
* @param {Object} config
|
|
714
|
-
* @param {string} config.text - Badge text
|
|
715
|
-
* @param {string} config.variant - success|warning|error
|
|
716
|
-
*/
|
|
717
|
-
WorkrailComponents.Badge = function(config) {
|
|
718
|
-
const { text, variant = 'info' } = config;
|
|
719
|
-
return createElement('span', ['badge', `badge-${variant}`], {}, [text]);
|
|
720
|
-
};
|
|
721
|
-
```
|
|
722
|
-
|
|
723
|
-
## 🎯 Migration Checklist
|
|
724
|
-
|
|
725
|
-
- [ ] Include `components.js` in all HTML pages
|
|
726
|
-
- [ ] Replace manual session card creation with `SessionCard` component
|
|
727
|
-
- [ ] Replace button HTML with `Button` component
|
|
728
|
-
- [ ] Replace modal HTML with `Modal` component
|
|
729
|
-
- [ ] Replace hero sections with `Hero` component
|
|
730
|
-
- [ ] Test all interactive features
|
|
731
|
-
- [ ] Verify design system compliance
|
|
732
|
-
- [ ] Remove redundant inline styles
|
|
733
|
-
|
|
734
|
-
## 🐛 Troubleshooting
|
|
735
|
-
|
|
736
|
-
**Icons not showing?**
|
|
737
|
-
- Ensure Lucide is loaded: `<script src="https://unpkg.com/lucide@latest"></script>`
|
|
738
|
-
- Icons are initialized automatically, but you can manually trigger: `lucide.createIcons()`
|
|
739
|
-
|
|
740
|
-
**Styles not applied?**
|
|
741
|
-
- Ensure CSS is loaded before `components.js`
|
|
742
|
-
- Check that design system CSS is included
|
|
743
|
-
|
|
744
|
-
**Components not found?**
|
|
745
|
-
- Check console for `[Workrail Components] Library loaded`
|
|
746
|
-
- Ensure `components.js` loads without errors
|
|
747
|
-
|
|
748
|
-
---
|
|
749
|
-
|
|
750
|
-
**Version**: 1.0.0
|
|
751
|
-
**Last Updated**: October 2, 2025
|
|
752
|
-
**Maintained By**: Workrail Team
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|