@geekmidas/ui 0.1.0 → 1.0.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.
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Theme constants for the UI component library.
3
+ * Inspired by Supabase's dark theme design.
4
+ */
5
+ export const theme = {
6
+ colors: {
7
+ // Background colors
8
+ background: '#171717',
9
+ surface: '#1c1c1c',
10
+ surfaceHover: '#262626',
11
+ surfaceActive: '#2a2a2a',
12
+
13
+ // Border colors
14
+ border: '#2e2e2e',
15
+ borderHover: '#3e3e3e',
16
+ borderFocus: '#3ecf8e',
17
+
18
+ // Text colors
19
+ text: '#fafafa',
20
+ textMuted: '#a1a1aa',
21
+ textSubtle: '#71717a',
22
+
23
+ // Accent colors
24
+ accent: '#3ecf8e',
25
+ accentHover: '#4ade80',
26
+ accentMuted: '#22c55e',
27
+
28
+ // Semantic colors
29
+ error: '#ef4444',
30
+ errorMuted: '#dc2626',
31
+ warning: '#f59e0b',
32
+ warningMuted: '#d97706',
33
+ info: '#3b82f6',
34
+ infoMuted: '#2563eb',
35
+ success: '#22c55e',
36
+ successMuted: '#16a34a',
37
+ },
38
+
39
+ // HTTP method colors
40
+ methods: {
41
+ GET: '#3b82f6',
42
+ POST: '#22c55e',
43
+ PUT: '#f59e0b',
44
+ PATCH: '#8b5cf6',
45
+ DELETE: '#ef4444',
46
+ HEAD: '#6b7280',
47
+ OPTIONS: '#6b7280',
48
+ } as const,
49
+
50
+ // HTTP status code colors
51
+ status: {
52
+ '1xx': '#6b7280',
53
+ '2xx': '#22c55e',
54
+ '3xx': '#3b82f6',
55
+ '4xx': '#f59e0b',
56
+ '5xx': '#ef4444',
57
+ } as const,
58
+
59
+ // Log level colors
60
+ logLevels: {
61
+ trace: '#6b7280',
62
+ debug: '#6b7280',
63
+ info: '#3b82f6',
64
+ warn: '#f59e0b',
65
+ error: '#ef4444',
66
+ fatal: '#dc2626',
67
+ } as const,
68
+
69
+ // Spacing scale
70
+ spacing: {
71
+ xs: '0.25rem',
72
+ sm: '0.5rem',
73
+ md: '1rem',
74
+ lg: '1.5rem',
75
+ xl: '2rem',
76
+ '2xl': '3rem',
77
+ } as const,
78
+
79
+ // Border radius
80
+ radius: {
81
+ sm: '0.25rem',
82
+ md: '0.375rem',
83
+ lg: '0.5rem',
84
+ xl: '0.75rem',
85
+ full: '9999px',
86
+ } as const,
87
+
88
+ // Font sizes
89
+ fontSize: {
90
+ xs: '0.75rem',
91
+ sm: '0.875rem',
92
+ base: '1rem',
93
+ lg: '1.125rem',
94
+ xl: '1.25rem',
95
+ '2xl': '1.5rem',
96
+ } as const,
97
+
98
+ // Transitions
99
+ transition: {
100
+ fast: '150ms ease',
101
+ normal: '200ms ease',
102
+ slow: '300ms ease',
103
+ } as const,
104
+ } as const;
105
+
106
+ export type Theme = typeof theme;
107
+ export type ThemeColors = typeof theme.colors;
108
+ export type HttpMethod = keyof typeof theme.methods;
109
+ export type StatusRange = keyof typeof theme.status;
110
+ export type LogLevel = keyof typeof theme.logLevels;
111
+
112
+ /**
113
+ * Get the color for an HTTP method.
114
+ */
115
+ export function getMethodColor(method: string): string {
116
+ const upperMethod = method.toUpperCase() as HttpMethod;
117
+ return theme.methods[upperMethod] ?? theme.colors.textMuted;
118
+ }
119
+
120
+ /**
121
+ * Get the color for an HTTP status code.
122
+ */
123
+ export function getStatusColor(status: number): string {
124
+ if (status >= 100 && status < 200) return theme.status['1xx'];
125
+ if (status >= 200 && status < 300) return theme.status['2xx'];
126
+ if (status >= 300 && status < 400) return theme.status['3xx'];
127
+ if (status >= 400 && status < 500) return theme.status['4xx'];
128
+ if (status >= 500) return theme.status['5xx'];
129
+ return theme.colors.textMuted;
130
+ }
131
+
132
+ /**
133
+ * Get the color for a log level.
134
+ */
135
+ export function getLogLevelColor(level: string): string {
136
+ const lowerLevel = level.toLowerCase() as LogLevel;
137
+ return theme.logLevels[lowerLevel] ?? theme.colors.textMuted;
138
+ }
@@ -1,97 +0,0 @@
1
- #!/usr/bin/env tsx
2
- /**
3
- * Script to embed built UI assets into a TypeScript file.
4
- * This allows packages to serve the UI without external files.
5
- *
6
- * Usage: embed-ui <input-dir> <output-file>
7
- * Example: embed-ui dist/ui src/ui-assets.ts
8
- */
9
- import { readFileSync, readdirSync, writeFileSync } from 'fs';
10
-
11
- interface Asset {
12
- path: string;
13
- content: string;
14
- contentType: string;
15
- }
16
-
17
- function getContentType(filename: string): string {
18
- if (filename.endsWith('.html')) return 'text/html';
19
- if (filename.endsWith('.css')) return 'text/css';
20
- if (filename.endsWith('.js')) return 'application/javascript';
21
- if (filename.endsWith('.map')) return 'application/json';
22
- return 'application/octet-stream';
23
- }
24
-
25
- function collectAssets(dir: string, basePath: string = ''): Asset[] {
26
- const assets: Asset[] = [];
27
- const entries = readdirSync(dir, { withFileTypes: true });
28
-
29
- for (const entry of entries) {
30
- const fullPath = `${dir}/${entry.name}`;
31
- const assetPath = basePath ? `${basePath}/${entry.name}` : entry.name;
32
-
33
- if (entry.isDirectory()) {
34
- assets.push(...collectAssets(fullPath, assetPath));
35
- } else if (!entry.name.endsWith('.map')) {
36
- // Skip source maps
37
- const content = readFileSync(fullPath, 'utf-8');
38
- assets.push({
39
- path: assetPath,
40
- content,
41
- contentType: getContentType(entry.name),
42
- });
43
- }
44
- }
45
-
46
- return assets;
47
- }
48
-
49
- const args = process.argv.slice(2);
50
- if (args.length !== 2) {
51
- console.error('Usage: embed-ui <input-dir> <output-file>');
52
- console.error('Example: embed-ui dist/ui src/ui-assets.ts');
53
- process.exit(1);
54
- }
55
-
56
- const [inputDir, outputFile] = args;
57
-
58
- try {
59
- const assets = collectAssets(inputDir);
60
-
61
- // Find the index.html to extract references
62
- const indexHtml = assets.find((a) => a.path === 'index.html');
63
- if (!indexHtml) {
64
- console.error('index.html not found in build output');
65
- process.exit(1);
66
- }
67
-
68
- // Generate TypeScript file
69
- const output = `// Auto-generated file - do not edit directly
70
- // Generated by @geekmidas/ui/scripts/embed-ui.ts
71
-
72
- export interface UIAsset {
73
- path: string;
74
- content: string;
75
- contentType: string;
76
- }
77
-
78
- export const UI_ASSETS: UIAsset[] = ${JSON.stringify(assets, null, 2)};
79
-
80
- export function getAsset(path: string): UIAsset | undefined {
81
- // Normalize path
82
- const normalized = path.replace(/^\\//, '');
83
- return UI_ASSETS.find((a) => a.path === normalized);
84
- }
85
-
86
- export function getIndexHtml(): string {
87
- const asset = UI_ASSETS.find((a) => a.path === 'index.html');
88
- return asset?.content ?? '';
89
- }
90
- `;
91
-
92
- writeFileSync(outputFile, output);
93
- console.error(`Embedded ${assets.length} UI assets into ${outputFile}`);
94
- } catch (error) {
95
- console.error('Error embedding UI assets:', error);
96
- process.exit(1);
97
- }
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export {};