@kb-labs/studio-app 0.7.0 → 2.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.
Files changed (175) hide show
  1. package/dist/index.html +1 -0
  2. package/dist/main.80b70197.css +2 -0
  3. package/dist/main.80b70197.css.map +1 -0
  4. package/dist/main.ad42ef4a.js +522 -0
  5. package/dist/main.ad42ef4a.js.map +1 -0
  6. package/dist/mf-manifest.json +241 -0
  7. package/dist/mf-stats.json +271 -0
  8. package/package.json +56 -39
  9. package/server.js +68 -0
  10. package/.env.example +0 -10
  11. package/UI-KIT-COMPONENTS.md +0 -783
  12. package/UI-KIT-PLAN.md +0 -326
  13. package/eslint-rules/no-direct-antd-import.js +0 -151
  14. package/eslint.config.ts +0 -27
  15. package/index.html +0 -17
  16. package/postcss.config.js +0 -7
  17. package/public/favicon.ico +0 -0
  18. package/rspack.config.mjs +0 -118
  19. package/src/App.tsx +0 -46
  20. package/src/components/devtools/devtools-log-feed.module.css +0 -165
  21. package/src/components/devtools/devtools-log-feed.tsx +0 -300
  22. package/src/components/devtools/devtools-panel.module.css +0 -121
  23. package/src/components/devtools/devtools-panel.tsx +0 -115
  24. package/src/components/empty-state.tsx +0 -28
  25. package/src/components/error-boundary.tsx +0 -210
  26. package/src/components/health-banner.module.css +0 -103
  27. package/src/components/health-banner.tsx +0 -134
  28. package/src/components/health-indicator.tsx +0 -12
  29. package/src/components/page-header.tsx +0 -49
  30. package/src/components/page-transition.tsx +0 -24
  31. package/src/components/role-switcher.tsx +0 -148
  32. package/src/components/run-badge.tsx +0 -13
  33. package/src/components/ui/icons.tsx +0 -509
  34. package/src/components/ui/index.ts +0 -25
  35. package/src/components/ui/kb-config-provider.tsx +0 -130
  36. package/src/components/ui/kb-header.module.css +0 -51
  37. package/src/components/ui/kb-header.tsx +0 -112
  38. package/src/components/ui/kb-notification-bell.module.css +0 -103
  39. package/src/components/ui/kb-notification-bell.tsx +0 -199
  40. package/src/components/ui/kb-page-layout.tsx +0 -66
  41. package/src/components/ui/kb-quick-search.module.css +0 -86
  42. package/src/components/ui/kb-quick-search.tsx +0 -196
  43. package/src/components/ui/kb-sidebar.module.css +0 -47
  44. package/src/components/ui/kb-sidebar.tsx +0 -196
  45. package/src/components/ui/kb-stat-card.module.css +0 -21
  46. package/src/components/ui/kb-stat-card.tsx +0 -22
  47. package/src/components/ui/kb-stat-grid.tsx +0 -22
  48. package/src/components/ui/kb-status-bar.module.css +0 -49
  49. package/src/components/ui/kb-status-bar.tsx +0 -145
  50. package/src/components/ui/kb-system-health-indicator.tsx +0 -229
  51. package/src/components/ui/kb-theme-toggle.tsx +0 -42
  52. package/src/components/ui/theme-adapter.ts +0 -812
  53. package/src/components/ui/theme-transition-overlay.tsx +0 -70
  54. package/src/components/ui/utils.ts +0 -6
  55. package/src/components/widget-error-boundary.tsx +0 -172
  56. package/src/config/env.ts +0 -5
  57. package/src/config/feature-flags.ts +0 -482
  58. package/src/config/studio.config.schema.ts +0 -88
  59. package/src/config/studio.config.ts +0 -84
  60. package/src/env.d.ts +0 -23
  61. package/src/hooks/use-command-palette.ts +0 -6
  62. package/src/hooks/use-devtools-store.ts +0 -25
  63. package/src/hooks/use-feature-flags.ts +0 -101
  64. package/src/index.css +0 -10
  65. package/src/layouts/dashboard-grid.tsx +0 -122
  66. package/src/layouts/index.ts +0 -12
  67. package/src/layouts/two-pane.tsx +0 -134
  68. package/src/main.tsx +0 -15
  69. package/src/modules/analytics/components/analytics-daily-stats-chart.tsx +0 -257
  70. package/src/modules/analytics/components/analytics-date-range-picker.tsx +0 -121
  71. package/src/modules/analytics/pages/analytics-cache-page.tsx +0 -285
  72. package/src/modules/analytics/pages/analytics-embeddings-page.tsx +0 -274
  73. package/src/modules/analytics/pages/analytics-events-page.tsx +0 -425
  74. package/src/modules/analytics/pages/analytics-llm-page.tsx +0 -434
  75. package/src/modules/analytics/pages/analytics-overview-page.tsx +0 -336
  76. package/src/modules/analytics/pages/analytics-page.tsx +0 -20
  77. package/src/modules/analytics/pages/analytics-storage-page.tsx +0 -344
  78. package/src/modules/analytics/pages/analytics-vectorstore-page.tsx +0 -279
  79. package/src/modules/analytics/routes/index.tsx +0 -133
  80. package/src/modules/analytics/utils/formatters.test.ts +0 -148
  81. package/src/modules/analytics/utils/formatters.ts +0 -100
  82. package/src/modules/auth/pages/login-page.module.css +0 -113
  83. package/src/modules/auth/pages/login-page.tsx +0 -80
  84. package/src/modules/auth/routes/index.tsx +0 -24
  85. package/src/modules/dashboard/components/ActivityTimelineWidget.tsx +0 -199
  86. package/src/modules/dashboard/components/AiInsightsWidget.tsx +0 -358
  87. package/src/modules/dashboard/components/AnimatedMetricCard.css +0 -88
  88. package/src/modules/dashboard/components/AnimatedMetricCard.tsx +0 -125
  89. package/src/modules/dashboard/components/HeroMetricCard.css +0 -114
  90. package/src/modules/dashboard/components/HeroMetricCard.tsx +0 -152
  91. package/src/modules/dashboard/components/HeroMetricsWidget.tsx +0 -146
  92. package/src/modules/dashboard/components/SystemResourcesWidget.tsx +0 -197
  93. package/src/modules/dashboard/components/dashboard-empty.tsx +0 -22
  94. package/src/modules/dashboard/components/dashboard-kpis-widget.tsx +0 -59
  95. package/src/modules/dashboard/components/dashboard-kpis.tsx +0 -13
  96. package/src/modules/dashboard/components/dashboard-latency-percentiles-widget.tsx +0 -85
  97. package/src/modules/dashboard/components/dashboard-metrics-widget.tsx +0 -78
  98. package/src/modules/dashboard/components/dashboard-plugins-widget.tsx +0 -67
  99. package/src/modules/dashboard/components/dashboard-requests-widget.tsx +0 -62
  100. package/src/modules/dashboard/layouts/dashboard-layout.tsx +0 -16
  101. package/src/modules/dashboard/pages/ai-insights-page.tsx +0 -563
  102. package/src/modules/dashboard/pages/dashboard-animations.css +0 -317
  103. package/src/modules/dashboard/pages/dashboard-page.tsx +0 -13
  104. package/src/modules/dashboard/routes/index.tsx +0 -70
  105. package/src/modules/observability/pages/devkit-page.tsx +0 -263
  106. package/src/modules/observability/pages/incident-detail-page.tsx +0 -571
  107. package/src/modules/observability/pages/incidents-page.tsx +0 -370
  108. package/src/modules/observability/pages/log-detail-page.tsx +0 -508
  109. package/src/modules/observability/pages/logs-page.tsx +0 -1129
  110. package/src/modules/observability/pages/prometheus-metrics-page.tsx +0 -486
  111. package/src/modules/observability/pages/state-broker-page.tsx +0 -229
  112. package/src/modules/observability/pages/system-events-page.tsx +0 -255
  113. package/src/modules/observability/routes/index.tsx +0 -133
  114. package/src/modules/plugins/components/marketplace-card.tsx +0 -153
  115. package/src/modules/plugins/components/plugin-ai-assistant-modal.tsx +0 -374
  116. package/src/modules/plugins/components/plugin-card.tsx +0 -136
  117. package/src/modules/plugins/components/plugin-detail/capabilities-summary.tsx +0 -101
  118. package/src/modules/plugins/components/plugin-detail/cli-commands-table.tsx +0 -101
  119. package/src/modules/plugins/components/plugin-detail/index.ts +0 -7
  120. package/src/modules/plugins/components/plugin-detail/jobs-table.tsx +0 -64
  121. package/src/modules/plugins/components/plugin-detail/permissions/env-permissions.tsx +0 -30
  122. package/src/modules/plugins/components/plugin-detail/permissions/filesystem-permissions.tsx +0 -68
  123. package/src/modules/plugins/components/plugin-detail/permissions/index.ts +0 -6
  124. package/src/modules/plugins/components/plugin-detail/permissions/network-permissions.tsx +0 -43
  125. package/src/modules/plugins/components/plugin-detail/permissions/platform-services.tsx +0 -242
  126. package/src/modules/plugins/components/plugin-detail/permissions/resource-quotas.tsx +0 -96
  127. package/src/modules/plugins/components/plugin-detail/permissions/shell-permissions.tsx +0 -55
  128. package/src/modules/plugins/components/plugin-detail/permissions-view.tsx +0 -47
  129. package/src/modules/plugins/components/plugin-detail/plugin-header.tsx +0 -169
  130. package/src/modules/plugins/components/plugin-detail/rest-routes-table.tsx +0 -159
  131. package/src/modules/plugins/components/plugin-detail/workflows-table.tsx +0 -40
  132. package/src/modules/plugins/components/plugin-grid.tsx +0 -20
  133. package/src/modules/plugins/components/plugin-table.tsx +0 -178
  134. package/src/modules/plugins/pages/marketplace-page.tsx +0 -200
  135. package/src/modules/plugins/pages/plugin-detail-page.tsx +0 -1145
  136. package/src/modules/plugins/routes/index.tsx +0 -48
  137. package/src/modules/plugins/utils/index.ts +0 -1
  138. package/src/modules/plugins/utils/schema-helpers.ts +0 -21
  139. package/src/modules/settings/components/api-routes-viewer.tsx +0 -415
  140. package/src/modules/settings/components/appearance-settings.tsx +0 -200
  141. package/src/modules/settings/components/configuration-settings.tsx +0 -321
  142. package/src/modules/settings/components/data-privacy-settings.tsx +0 -111
  143. package/src/modules/settings/components/experimental-settings.tsx +0 -243
  144. package/src/modules/settings/components/navigation-settings.tsx +0 -198
  145. package/src/modules/settings/components/notifications-settings.tsx +0 -40
  146. package/src/modules/settings/pages/settings-page.tsx +0 -298
  147. package/src/modules/settings/routes/index.tsx +0 -47
  148. package/src/pages/README-assistant.md +0 -91
  149. package/src/pages/login-page.tsx +0 -177
  150. package/src/pages/not-found-page.tsx +0 -85
  151. package/src/providers/auth-provider.tsx +0 -40
  152. package/src/providers/command-palette-provider.tsx +0 -193
  153. package/src/providers/data-sources-provider.tsx +0 -27
  154. package/src/providers/devtools-provider.tsx +0 -72
  155. package/src/providers/navigation-items-provider.tsx +0 -38
  156. package/src/providers/registry-v2-provider.tsx +0 -93
  157. package/src/providers/settings-provider.tsx +0 -158
  158. package/src/router.tsx +0 -302
  159. package/src/routes/helpers.tsx +0 -25
  160. package/src/routes/plugin-page-v2.tsx +0 -52
  161. package/src/routes/types.ts +0 -18
  162. package/src/styles/antd-overrides.css +0 -211
  163. package/src/styles/base.css +0 -190
  164. package/src/styles/settings.css +0 -75
  165. package/src/styles/variables.css +0 -94
  166. package/src/utils/analytics.ts +0 -183
  167. package/src/utils/apply-navigation-categories.ts +0 -83
  168. package/src/utils/commands.ts +0 -252
  169. package/src/utils/export.ts +0 -174
  170. package/src/utils/format-date.ts +0 -166
  171. package/src/utils/logger.ts +0 -110
  172. package/tailwind.config.ts +0 -13
  173. package/tsconfig.json +0 -13
  174. package/vitest-setup.ts +0 -1
  175. /package/{public → dist}/favicon.svg +0 -0
package/UI-KIT-PLAN.md DELETED
@@ -1,326 +0,0 @@
1
- # KB Labs Studio UI Kit - Component Plan
2
-
3
- ## 🎯 Goal
4
- Create a unified UI Kit using design tokens from `@kb-labs/studio-ui-core` and Ant Design theme tokens.
5
-
6
- **Critical Requirements:**
7
- - ✅ NO hardcoded colors (no `#DC2626`, `rgb()`, etc.)
8
- - ✅ Use ONLY Ant Design tokens via `theme.useToken()`
9
- - ✅ Use design tokens from `@kb-labs/studio-ui-core` for spacing/typography
10
- - ✅ NO inline styles in widget components
11
-
12
- ## 📊 Current Analysis
13
-
14
- ### Inline Styles Usage
15
- - **Total inline styles found**: 98 instances
16
- - **Most common patterns**:
17
- - Font sizes: `fontSize: '0.85em'`, `fontSize: '1.5rem'`
18
- - Colors: `color: 'var(--text-secondary)'`, `color: 'var(--error-color)'`
19
- - Spacing: `marginBottom: 16`, `padding: '12px 16px'`
20
- - Font weights: `fontWeight: 700`
21
-
22
- ### Most Used Ant Design Components
23
- Based on current widget implementation:
24
-
25
- 1. **Typography** - Text, Title, Paragraph (used in ~10 places)
26
- 2. **Space** - Spacing layout (used in ~10 places)
27
- 3. **Button** - Actions (used in ~7 places)
28
- 4. **Card** - Container (used in ~6 places)
29
- 5. **Tag** - Labels/badges (used in ~5 places)
30
- 6. **Badge** - Status indicators (used in ~4 places)
31
- 7. **Form** - Form elements (used in ~4 places)
32
- 8. **Typography.Text** - Inline text (used in ~4 places)
33
-
34
- ## 🏗️ UI Kit Component Hierarchy
35
-
36
- ### Tier 1: Primitives (Foundation)
37
- **Status: ✅ Complete**
38
-
39
- These are the building blocks - lowest level components.
40
-
41
- - ✅ **Text** - Typography primitive with semantic colors
42
- - Sizes: xs, sm, base, lg, xl, 2xl
43
- - Weights: normal, medium, semibold, bold
44
- - Colors: primary, secondary, success, warning, error, info
45
- - Uses: `typography.fontSize`, `typography.fontWeight`, `token.colorText`
46
-
47
- - ✅ **Box** - Layout primitive with spacing
48
- - Props: p, pt, pr, pb, pl, m, mt, mr, mb, ml
49
- - Uses: `spacing` tokens from `@kb-labs/studio-ui-core`
50
-
51
- - ✅ **Flex** - Flexbox layout primitive
52
- - Props: direction, justify, align, gap, wrap
53
- - Uses: `spacing` tokens for gap
54
-
55
- ### Tier 2: Basic Components
56
- **Status: 🔄 In Progress**
57
-
58
- Built on primitives, add semantic meaning.
59
-
60
- - ✅ **MetricCard** - Metric display with trend
61
- - Uses: Text, Flex, Box, Ant Card
62
- - Status: Complete, used in Metric and MetricGroup widgets
63
-
64
- - 🔄 **Badge** - Status indicator
65
- - Variants: success, warning, error, info, default
66
- - Uses: Ant Badge with token colors
67
- - Status: Created, needs export and usage
68
-
69
- - ⏳ **Tag** - Label/category indicator (NEXT)
70
- - Variants: success, warning, error, info, default, neutral
71
- - Uses: Ant Tag with token colors
72
- - Usage: Card widget (4 instances), Timeline (2 instances)
73
-
74
- - ⏳ **Button** - Action button (NEXT)
75
- - Variants: primary, default, text, link, danger
76
- - Sizes: small, default, large
77
- - Uses: Ant Button with consistent styling
78
- - Usage: Alert, Confirm, ErrorState, Form (~7 instances)
79
-
80
- - ⏳ **Stack** - Vertical/horizontal spacing layout
81
- - Props: direction, spacing, align
82
- - Uses: Box/Flex with consistent gap tokens
83
- - Usage: Multiple widgets for consistent spacing
84
-
85
- ### Tier 3: Complex Components
86
- **Status: ⏳ Not Started**
87
-
88
- Domain-specific components built from Tier 1 + 2.
89
-
90
- - ⏳ **CardContent** - Enhanced card with header/footer/sections
91
- - Uses: Box, Text, Tag, Badge, Ant Card
92
- - Usage: Card widget (6 inline styles)
93
-
94
- - ⏳ **TimelineItem** - Timeline entry with status
95
- - Uses: Badge, Text, Stack
96
- - Usage: Timeline widget (6 inline styles)
97
-
98
- - ⏳ **LogEntry** - Log line with level badge
99
- - Uses: Badge, Text, Flex
100
- - Usage: Logs widget (7 inline styles)
101
-
102
- - ⏳ **JsonView** - JSON display with syntax highlighting
103
- - Uses: Box, Text
104
- - Usage: Json widget (8 inline styles)
105
-
106
- ## 📋 Implementation Plan
107
-
108
- ### Phase 1: Complete Basic Components (Current Phase)
109
- **Goal**: Build foundation layer of reusable components
110
-
111
- #### Step 1.1: Export Badge ✅
112
- - [x] Badge.tsx created
113
- - [ ] Add to ui/index.ts
114
- - [ ] Test in isolation
115
-
116
- #### Step 1.2: Create Tag Component
117
- ```typescript
118
- // apps/studio/src/ui/Tag.tsx
119
- export type TagVariant = 'success' | 'warning' | 'error' | 'info' | 'default' | 'neutral';
120
-
121
- export function Tag({ variant, children, closable, onClose }: TagProps) {
122
- const { token } = useToken();
123
-
124
- const colorMap: Record<TagVariant, string> = {
125
- success: token.colorSuccess,
126
- warning: token.colorWarning,
127
- error: token.colorError,
128
- info: token.colorInfo,
129
- default: token.colorPrimary,
130
- neutral: token.colorTextSecondary,
131
- };
132
-
133
- return <AntTag color={colorMap[variant]} closable={closable} onClose={onClose}>{children}</AntTag>;
134
- }
135
- ```
136
-
137
- #### Step 1.3: Create Button Component
138
- ```typescript
139
- // apps/studio/src/ui/Button.tsx
140
- export type ButtonVariant = 'primary' | 'default' | 'text' | 'link' | 'danger';
141
- export type ButtonSize = 'small' | 'default' | 'large';
142
-
143
- export function Button({ variant, size, children, icon, loading, disabled, onClick }: ButtonProps) {
144
- return (
145
- <AntButton
146
- type={variantMap[variant]}
147
- size={size}
148
- icon={icon}
149
- loading={loading}
150
- disabled={disabled}
151
- onClick={onClick}
152
- >
153
- {children}
154
- </AntButton>
155
- );
156
- }
157
- ```
158
-
159
- #### Step 1.4: Create Stack Component
160
- ```typescript
161
- // apps/studio/src/ui/Stack.tsx
162
- export type StackDirection = 'vertical' | 'horizontal';
163
- export type StackSpacing = SpacingValue;
164
-
165
- export function Stack({ direction = 'vertical', spacing = 2, align, children }: StackProps) {
166
- return (
167
- <Flex
168
- direction={direction === 'vertical' ? 'column' : 'row'}
169
- gap={spacing}
170
- align={align}
171
- >
172
- {children}
173
- </Flex>
174
- );
175
- }
176
- ```
177
-
178
- ### Phase 2: Migrate High-Priority Widgets
179
- **Goal**: Eliminate most inline styles by migrating top offenders
180
-
181
- Priority order by inline style count:
182
-
183
- 1. **Json** (8 styles) - needs JsonView component
184
- 2. **Logs** (7 styles) - needs LogEntry component
185
- 3. **Timeline** (6 styles) - needs TimelineItem component
186
- 4. **Card** (6 styles) - needs CardContent component or direct Tag/Badge usage
187
- 5. **MetricGroup** ✅ (5 styles) - DONE
188
- 6. **Metric** ✅ (5 styles) - DONE
189
-
190
- ### Phase 3: Create Complex Components
191
- **Goal**: Domain-specific components for remaining widgets
192
-
193
- #### CardContent Component
194
- ```typescript
195
- // apps/studio/src/ui/CardContent.tsx
196
- export interface CardContentProps {
197
- title?: string;
198
- subtitle?: string;
199
- tags?: { label: string; variant: TagVariant }[];
200
- badges?: { label: string; variant: BadgeVariant }[];
201
- extra?: React.ReactNode;
202
- footer?: React.ReactNode;
203
- children: React.ReactNode;
204
- }
205
-
206
- export function CardContent({ title, subtitle, tags, badges, extra, footer, children }: CardContentProps) {
207
- // Uses: Box, Text, Tag, Badge, Stack
208
- }
209
- ```
210
-
211
- #### TimelineItem Component
212
- ```typescript
213
- // apps/studio/src/ui/TimelineItem.tsx
214
- export interface TimelineItemProps {
215
- timestamp: string;
216
- title: string;
217
- description?: string;
218
- status?: 'success' | 'warning' | 'error' | 'info';
219
- icon?: React.ReactNode;
220
- }
221
-
222
- export function TimelineItem({ timestamp, title, description, status, icon }: TimelineItemProps) {
223
- // Uses: Badge, Text, Stack, Flex
224
- }
225
- ```
226
-
227
- ### Phase 4: Complete Migration
228
- **Goal**: Eliminate ALL inline styles from widget components
229
-
230
- Remaining widgets (~20 widgets) with <5 inline styles each.
231
-
232
- ## 🎨 Design Token Usage
233
-
234
- ### Colors (from Ant Design theme.useToken())
235
- ```typescript
236
- const { token } = useToken();
237
-
238
- // Semantic colors
239
- token.colorPrimary // Primary brand color
240
- token.colorSuccess // Success/positive
241
- token.colorWarning // Warning/caution
242
- token.colorError // Error/danger
243
- token.colorInfo // Info/neutral
244
-
245
- // Text colors
246
- token.colorText // Primary text
247
- token.colorTextSecondary // Secondary text
248
- token.colorTextDisabled // Disabled text
249
-
250
- // Background colors
251
- token.colorBgContainer // Container background
252
- token.colorBgElevated // Elevated background
253
- token.colorBorder // Border color
254
- ```
255
-
256
- ### Spacing (from @kb-labs/studio-ui-core)
257
- ```typescript
258
- import { spacing } from '@kb-labs/studio-ui-core';
259
-
260
- spacing[0] // 0
261
- spacing[1] // 0.25rem
262
- spacing[2] // 0.5rem
263
- spacing[3] // 0.75rem
264
- spacing[4] // 1rem
265
- spacing[6] // 1.5rem
266
- spacing[8] // 2rem
267
- ```
268
-
269
- ### Typography (from @kb-labs/studio-ui-core)
270
- ```typescript
271
- import { typography } from '@kb-labs/studio-ui-core';
272
-
273
- typography.fontSize.xs // ['0.75rem', { lineHeight: '1rem' }]
274
- typography.fontSize.sm // ['0.875rem', { lineHeight: '1.25rem' }]
275
- typography.fontSize.base // ['1rem', { lineHeight: '1.5rem' }]
276
- typography.fontSize.lg // ['1.125rem', { lineHeight: '1.75rem' }]
277
- typography.fontSize.xl // ['1.25rem', { lineHeight: '1.75rem' }]
278
- typography.fontSize['2xl'] // ['1.5rem', { lineHeight: '2rem' }]
279
-
280
- typography.fontWeight.normal // 400
281
- typography.fontWeight.medium // 500
282
- typography.fontWeight.semibold // 600
283
- typography.fontWeight.bold // 700
284
- ```
285
-
286
- ## ✅ Success Criteria
287
-
288
- ### Component Quality
289
- - [ ] All components use ONLY design tokens (no hardcoded values)
290
- - [ ] All components have proper TypeScript types
291
- - [ ] All components are documented with examples
292
- - [ ] All components are exported from ui/index.ts
293
-
294
- ### Widget Migration
295
- - [ ] Zero inline styles in widget components
296
- - [ ] All colors use Ant Design tokens
297
- - [ ] All spacing uses spacing tokens
298
- - [ ] All typography uses typography tokens
299
-
300
- ### Code Quality
301
- - [ ] Build passes without errors
302
- - [ ] Type check passes
303
- - [ ] Lint passes
304
- - [ ] No CSS variables (var(--*)) - use tokens instead
305
-
306
- ## 📝 Notes
307
-
308
- ### DO ✅
309
- - Use `theme.useToken()` for ALL colors
310
- - Use `spacing` tokens for ALL margins/paddings/gaps
311
- - Use `typography` tokens for ALL font sizes/weights
312
- - Build components incrementally (primitives → basic → complex)
313
- - Test each component in isolation before using in widgets
314
-
315
- ### DON'T ❌
316
- - Hardcode colors like `#DC2626` or `rgb(220, 38, 38)`
317
- - Use CSS variables like `var(--success)` or `var(--text-secondary)`
318
- - Use magic numbers for spacing (`marginBottom: 16`)
319
- - Use string literals for font sizes (`fontSize: '1.5rem'`)
320
- - Skip token usage in favor of inline styles
321
-
322
- ---
323
-
324
- **Created**: 2026-01-27
325
- **Status**: Phase 1 in progress
326
- **Next Step**: Export Badge, create Tag component
@@ -1,151 +0,0 @@
1
- /**
2
- * ESLint rule: no-direct-antd-import
3
- *
4
- * Prevents direct imports from 'antd' or 'antd/*' in the studio app.
5
- * Provides specific component-level suggestions to use @kb-labs/studio-ui-kit equivalents.
6
- */
7
-
8
- /** @type {Map<string, string>} */
9
- const COMPONENT_MAP = {
10
- // Core
11
- Card: 'UICard',
12
- Button: 'UIButton',
13
- Tag: 'UITag',
14
- Badge: 'UIBadge',
15
- Spin: 'UISpin',
16
- Divider: 'UIDivider',
17
- // Layout
18
- Row: 'UIRow',
19
- Col: 'UICol',
20
- Space: 'UISpace',
21
- Flex: 'UIFlex',
22
- Grid: 'UIGrid',
23
- // Data display
24
- Table: 'UITable',
25
- List: 'UIList',
26
- Descriptions: 'UIDescriptions',
27
- Statistic: 'UIStatistic',
28
- Timeline: 'UITimeline',
29
- Avatar: 'UIAvatar',
30
- Tooltip: 'UITooltip',
31
- Progress: 'UIProgress',
32
- // Feedback
33
- Alert: 'UIAlert',
34
- Modal: 'UIModal',
35
- Drawer: 'UIDrawer',
36
- Popconfirm: 'UIPopconfirm',
37
- Empty: 'UIEmptyState',
38
- Skeleton: 'UISkeleton',
39
- // Navigation
40
- Tabs: 'UITabs',
41
- Menu: 'UIMenu',
42
- Segmented: 'UISegmented',
43
- Breadcrumb: 'UIBreadcrumb',
44
- // Form
45
- Form: 'UIForm',
46
- Input: 'UIInput',
47
- InputNumber: 'UIInputNumber',
48
- Select: 'UISelect',
49
- Checkbox: 'UICheckbox',
50
- Radio: 'UIRadio',
51
- Switch: 'UISwitch',
52
- DatePicker: 'UIDatePicker',
53
- TimePicker: 'UITimePicker',
54
- Slider: 'UISlider',
55
- Upload: 'UIUpload',
56
- // Layout structural
57
- Collapse: 'UIAccordion',
58
- // Typography
59
- Typography: 'UIText / UITitle (use UITypographyText, UITypographyParagraph, UITitle)',
60
- };
61
-
62
- /** @type {Record<string, string>} */
63
- const HOOK_MAP = {
64
- theme: 'useUITheme from @kb-labs/studio-ui-kit',
65
- message: 'UIMessage or useUIMessage from @kb-labs/studio-ui-kit',
66
- };
67
-
68
- /** @param {string[]} names */
69
- function buildSuggestion(names) {
70
- const mapped = [];
71
- const unknown = [];
72
-
73
- for (const name of names) {
74
- if (COMPONENT_MAP[name]) {
75
- mapped.push(`${name} → ${COMPONENT_MAP[name]}`);
76
- } else if (HOOK_MAP[name]) {
77
- mapped.push(`${name} → ${HOOK_MAP[name]}`);
78
- } else {
79
- unknown.push(name);
80
- }
81
- }
82
-
83
- const parts = [];
84
- if (mapped.length > 0) {
85
- parts.push(`Use from @kb-labs/studio-ui-kit: ${mapped.join(', ')}.`);
86
- }
87
- if (unknown.length > 0) {
88
- parts.push(
89
- `No UI Kit equivalent found for: ${unknown.join(', ')}. ` +
90
- `Add a wrapper in packages/studio-ui-kit/src/ and export it from the index.`,
91
- );
92
- }
93
- return parts.join(' ');
94
- }
95
-
96
- /** @type {import('eslint').Rule.RuleModule} */
97
- const rule = {
98
- meta: {
99
- type: 'problem',
100
- docs: {
101
- description: 'Disallow direct imports from antd — use @kb-labs/studio-ui-kit instead.',
102
- url: 'https://github.com/kb-labs/kb-labs-studio/blob/main/ANTD-MIGRATION-GUIDE.md',
103
- },
104
- messages: {
105
- noDirectAntd:
106
- 'Direct antd import is not allowed. {{ suggestion }}',
107
- noAntdSubpath:
108
- 'Direct antd subpath import is not allowed. Use @kb-labs/studio-ui-kit instead.',
109
- noAntdIcons:
110
- 'Import @ant-design/icons directly is not allowed. ' +
111
- 'Use <UIIcon name="IconName" /> from @kb-labs/studio-ui-kit or ' +
112
- 'renderIcon() from @kb-labs/studio-ui-react.',
113
- },
114
- schema: [],
115
- },
116
-
117
- create(context) {
118
- return {
119
- ImportDeclaration(node) {
120
- const source = node.source.value;
121
-
122
- // antd/es/... or antd/lib/... subpath imports — allow type-only imports
123
- if (typeof source === 'string' && source.startsWith('antd/')) {
124
- if (node.importKind === 'type') return;
125
- context.report({ node, messageId: 'noAntdSubpath' });
126
- return;
127
- }
128
-
129
- // direct 'antd' import
130
- if (source !== 'antd') return;
131
-
132
- // Collect imported names (skip type-only imports of unknown types)
133
- const names = node.specifiers
134
- .filter((s) => s.type === 'ImportSpecifier')
135
- .map((s) => s.imported.name);
136
-
137
- const suggestion = names.length > 0
138
- ? buildSuggestion(names)
139
- : 'Use @kb-labs/studio-ui-kit instead.';
140
-
141
- context.report({
142
- node,
143
- messageId: 'noDirectAntd',
144
- data: { suggestion },
145
- });
146
- },
147
- };
148
- },
149
- };
150
-
151
- module.exports = rule;
package/eslint.config.ts DELETED
@@ -1,27 +0,0 @@
1
- import reactPreset from '@kb-labs/devkit/eslint/react.js';
2
- import noDirectAntdImport from './eslint-rules/no-direct-antd-import.js';
3
-
4
- export default [
5
- ...reactPreset,
6
- {
7
- ignores: ['dist/**', 'coverage/**', 'eslint-rules/**', '.__mf__temp/**', '*.mjs']
8
- },
9
- {
10
- files: ['src/**/*.{ts,tsx}'],
11
- plugins: {
12
- 'studio-rules': {
13
- rules: { 'no-direct-antd-import': noDirectAntdImport },
14
- },
15
- },
16
- rules: {
17
- 'studio-rules/no-direct-antd-import': 'error',
18
- },
19
- },
20
- {
21
- // Low-level UI wrappers are allowed to import directly from antd / @ant-design
22
- files: ['src/components/ui/**/*.{ts,tsx}', 'src/ui/**/*.{ts,tsx}'],
23
- rules: {
24
- 'studio-rules/no-direct-antd-import': 'off',
25
- },
26
- },
27
- ];
package/index.html DELETED
@@ -1,17 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <base href="/" />
6
- <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
- <link rel="icon" type="image/x-icon" href="/favicon.ico" />
8
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
9
- <title>KB Labs Studio</title>
10
- <link rel="preconnect" href="https://fonts.googleapis.com" />
11
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
12
- <link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700&family=Plus+Jakarta+Sans:wght@600;700&display=swap" rel="stylesheet" />
13
- </head>
14
- <body>
15
- <div id="root"></div>
16
- </body>
17
- </html>
package/postcss.config.js DELETED
@@ -1,7 +0,0 @@
1
- export default {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- },
6
- };
7
-
Binary file
package/rspack.config.mjs DELETED
@@ -1,118 +0,0 @@
1
- import path from 'path';
2
- import { fileURLToPath } from 'url';
3
- import { defineConfig } from '@rspack/cli';
4
- import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';
5
- import { HtmlRspackPlugin } from '@rspack/core';
6
- import RefreshPlugin from '@rspack/plugin-react-refresh';
7
- import { STUDIO_SHARED_DEPS } from '@kb-labs/studio-plugin-tools';
8
-
9
- const isDev = process.env.NODE_ENV !== 'production';
10
- const __filename = fileURLToPath(import.meta.url);
11
- const __dirname = path.dirname(__filename);
12
-
13
- // Gateway URL for proxying API and plugin widget requests
14
- const proxyTarget = process.env.API_PROXY_TARGET || 'http://localhost:4000';
15
-
16
- // Expose KB_* env vars via import.meta.env
17
- const envDefines = {
18
- 'import.meta.env.MODE': JSON.stringify(isDev ? 'development' : 'production'),
19
- 'import.meta.env.DEV': JSON.stringify(isDev),
20
- 'import.meta.env.PROD': JSON.stringify(!isDev),
21
- };
22
- for (const [key, value] of Object.entries(process.env)) {
23
- if (key.startsWith('KB_') && value !== undefined) {
24
- envDefines[`import.meta.env.${key}`] = JSON.stringify(value);
25
- }
26
- }
27
-
28
- export default defineConfig({
29
- experiments: {
30
- css: true,
31
- },
32
- entry: { main: './src/main.tsx' },
33
- output: {
34
- path: path.resolve(__dirname, 'dist'),
35
- publicPath: 'auto',
36
- filename: isDev ? '[name].js' : '[name].[contenthash:8].js',
37
- clean: true,
38
- },
39
- resolve: {
40
- extensions: ['.tsx', '.ts', '.jsx', '.js'],
41
- alias: {
42
- '@': path.resolve(__dirname, 'src'),
43
- '@kb-labs/studio-ui-core': path.resolve(__dirname, '../../packages/studio-ui-core/src'),
44
- '@kb-labs/studio-data-client': path.resolve(__dirname, '../../packages/studio-data-client/src'),
45
- },
46
- },
47
- module: {
48
- parser: {
49
- 'css/auto': {
50
- namedExports: false,
51
- },
52
- css: {
53
- namedExports: false,
54
- },
55
- },
56
- generator: {
57
- 'css/auto': {
58
- exportsOnly: false,
59
- exportsConvention: 'as-is',
60
- },
61
- css: {
62
- exportsOnly: false,
63
- exportsConvention: 'as-is',
64
- },
65
- },
66
- rules: [
67
- {
68
- test: /\.tsx?$/,
69
- exclude: /node_modules/,
70
- use: {
71
- loader: 'builtin:swc-loader',
72
- options: {
73
- jsc: {
74
- parser: { syntax: 'typescript', tsx: true },
75
- transform: { react: { runtime: 'automatic', development: isDev, refresh: isDev } },
76
- },
77
- },
78
- },
79
- },
80
- {
81
- test: /\.css$/,
82
- use: ['postcss-loader'],
83
- type: 'css/auto',
84
- },
85
- {
86
- test: /\.(png|jpe?g|gif|svg|woff2?|eot|ttf|otf)$/,
87
- type: 'asset',
88
- },
89
- ],
90
- },
91
- plugins: [
92
- new HtmlRspackPlugin({
93
- template: './index.html',
94
- favicon: './public/favicon.svg',
95
- }),
96
- new ModuleFederationPlugin({
97
- name: 'studioHost',
98
- remotes: {},
99
- shared: Object.fromEntries(
100
- Object.entries(STUDIO_SHARED_DEPS).map(([key, val]) => [key, { ...val, eager: true }]),
101
- ),
102
- }),
103
- isDev && new RefreshPlugin(),
104
- ].filter(Boolean),
105
- devServer: {
106
- port: 3000,
107
- hot: true,
108
- historyApiFallback: true,
109
- proxy: [
110
- { context: ['/api'], target: proxyTarget, changeOrigin: true },
111
- { context: ['/plugins'], target: proxyTarget, changeOrigin: true },
112
- ],
113
- },
114
- builtins: {
115
- define: envDefines,
116
- },
117
- devtool: isDev ? 'source-map' : 'source-map',
118
- });
package/src/App.tsx DELETED
@@ -1,46 +0,0 @@
1
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
2
- import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
3
- import { RouterProvider } from 'react-router-dom';
4
- import { KBConfigProvider } from '@/components/ui/kb-config-provider';
5
- import { DataSourcesProvider } from './providers/data-sources-provider';
6
- import { AuthProvider } from './providers/auth-provider';
7
- import { RegistryV2Provider } from './providers/registry-v2-provider';
8
- import { SettingsProvider } from './providers/settings-provider';
9
- import { EventBusProvider } from '@kb-labs/studio-event-bus';
10
- import { router } from './router';
11
- import { studioConfig } from './config/studio.config';
12
- import { DevToolsProvider } from './providers/devtools-provider';
13
- import { DevToolsPanel } from './components/devtools/devtools-panel';
14
-
15
- const queryClient = new QueryClient({
16
- defaultOptions: {
17
- queries: {
18
- staleTime: 30000,
19
- refetchOnWindowFocus: false,
20
- },
21
- },
22
- });
23
-
24
- export function App() {
25
- return (
26
- <KBConfigProvider defaultTheme="light" storageKey="studio-ui-theme">
27
- <SettingsProvider>
28
- <AuthProvider>
29
- <QueryClientProvider client={queryClient}>
30
- <DataSourcesProvider>
31
- <DevToolsProvider>
32
- <RegistryV2Provider apiBaseUrl={studioConfig.apiBaseUrl}>
33
- <EventBusProvider>
34
- <RouterProvider router={router} />
35
- <ReactQueryDevtools initialIsOpen={false} />
36
- </EventBusProvider>
37
- </RegistryV2Provider>
38
- <DevToolsPanel />
39
- </DevToolsProvider>
40
- </DataSourcesProvider>
41
- </QueryClientProvider>
42
- </AuthProvider>
43
- </SettingsProvider>
44
- </KBConfigProvider>
45
- );
46
- }