truncgil-uxigl 0.0.0-stage → 2.5.2

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 (58) hide show
  1. package/README.md +124 -2
  2. package/bin/cli.mjs +410 -0
  3. package/dist/lib/style.css +1 -0
  4. package/dist/lib/types/components/brand/GithubIcon.d.ts +11 -0
  5. package/dist/lib/types/components/brand/UXILogo.d.ts +17 -0
  6. package/dist/lib/types/components/composites/Accordion/Accordion.d.ts +22 -0
  7. package/dist/lib/types/components/composites/Card/Card.d.ts +25 -0
  8. package/dist/lib/types/components/composites/CommandPalette/CommandPalette.d.ts +23 -0
  9. package/dist/lib/types/components/composites/DataTable/DataTable.d.ts +40 -0
  10. package/dist/lib/types/components/composites/FileManGLExplorerAdapter/FileManGLExplorerAdapter.d.ts +14 -0
  11. package/dist/lib/types/components/composites/Modal/Modal.d.ts +28 -0
  12. package/dist/lib/types/components/composites/SegmentedControl/SegmentedControl.d.ts +24 -0
  13. package/dist/lib/types/components/composites/SheetGLGridAdapter/SheetGLGridAdapter.d.ts +31 -0
  14. package/dist/lib/types/components/composites/Sidebar/Sidebar.d.ts +15 -0
  15. package/dist/lib/types/components/composites/StatCard/StatCard.d.ts +19 -0
  16. package/dist/lib/types/components/composites/Tabs/Tabs.d.ts +23 -0
  17. package/dist/lib/types/components/composites/TopHeader/TopHeader.d.ts +15 -0
  18. package/dist/lib/types/components/composites/WebGLAuroraCanvas/WebGLAuroraCanvas.d.ts +2 -0
  19. package/dist/lib/types/components/composites/index.d.ts +13 -0
  20. package/dist/lib/types/components/primitives/Alert/Alert.d.ts +21 -0
  21. package/dist/lib/types/components/primitives/Avatar/Avatar.d.ts +24 -0
  22. package/dist/lib/types/components/primitives/Badge/Badge.d.ts +16 -0
  23. package/dist/lib/types/components/primitives/Button/Button.d.ts +51 -0
  24. package/dist/lib/types/components/primitives/Checkbox/Checkbox.d.ts +14 -0
  25. package/dist/lib/types/components/primitives/Chip/Chip.d.ts +21 -0
  26. package/dist/lib/types/components/primitives/EnterpriseInputs/EnterpriseInputs.d.ts +81 -0
  27. package/dist/lib/types/components/primitives/GoogleIcon/GoogleIcon.d.ts +33 -0
  28. package/dist/lib/types/components/primitives/Input/Input.d.ts +40 -0
  29. package/dist/lib/types/components/primitives/Progress/Progress.d.ts +21 -0
  30. package/dist/lib/types/components/primitives/Skeleton/Skeleton.d.ts +17 -0
  31. package/dist/lib/types/components/primitives/Slider/Slider.d.ts +20 -0
  32. package/dist/lib/types/components/primitives/Switch/Switch.d.ts +17 -0
  33. package/dist/lib/types/components/primitives/Tooltip/Tooltip.d.ts +16 -0
  34. package/dist/lib/types/components/primitives/index.d.ts +14 -0
  35. package/dist/lib/types/core/contracts/ComponentContracts.d.ts +97 -0
  36. package/dist/lib/types/core/contracts/NavigationContract.d.ts +53 -0
  37. package/dist/lib/types/core/contracts/NotificationContract.d.ts +28 -0
  38. package/dist/lib/types/core/contracts/ThemeContract.d.ts +116 -0
  39. package/dist/lib/types/core/services/CodeGeneratorService.d.ts +22 -0
  40. package/dist/lib/types/core/services/RouteService.d.ts +41 -0
  41. package/dist/lib/types/core/services/StorageService.d.ts +14 -0
  42. package/dist/lib/types/core/services/ThemeEngineService.d.ts +22 -0
  43. package/dist/lib/types/core/tokens/designTokens.d.ts +22 -0
  44. package/dist/lib/types/hooks/useCopyToClipboard.d.ts +9 -0
  45. package/dist/lib/types/hooks/useKeyboardShortcut.d.ts +8 -0
  46. package/dist/lib/types/index.d.ts +23 -0
  47. package/dist/lib/types/providers/ThemeProvider.d.ts +10 -0
  48. package/dist/lib/types/providers/ToastProvider.d.ts +6 -0
  49. package/dist/lib/uxi_no_bg.png +0 -0
  50. package/dist/lib/uxigl-logo.svg +177 -0
  51. package/dist/lib/uxigl.cjs +67 -0
  52. package/dist/lib/uxigl.cjs.map +1 -0
  53. package/dist/lib/uxigl.js +6073 -0
  54. package/dist/lib/uxigl.js.map +1 -0
  55. package/docs/ARCHITECTURE.md +90 -0
  56. package/docs/logo/uxi.jpg +0 -0
  57. package/docs/logo/uxi_no_bg.png +0 -0
  58. package/package.json +81 -4
package/README.md CHANGED
@@ -1,3 +1,125 @@
1
- # Temporary Holding Version
1
+ # uxiGL — Modular Liquid Glass × Google Material You Design System
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **Uniting User Experience (UX), User Interface (UI), and Hardware-Accelerated WebGL (`SheetGL` + `FileManGL`) into a Single Enterprise Architecture.**
4
+
5
+ [![Version](https://img.shields.io/badge/version-2.5.0-0284c7.svg)](https://github.com/umitunc)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-3178c6.svg)](https://www.typescriptlang.org)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-10b981.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ---
10
+
11
+ ## 🎨 Brand Identity & Single-Glyph Monogram (`U` + `X` + `I`)
12
+
13
+ **`uxiGL`** is part of the `GL` ecosystem alongside **`SheetGL`** and **`FileManGL`**.
14
+
15
+ The [`UXILogo`](src/components/brand/UXILogo.tsx) emblem reduces the three letters **U**, **X**, and **I** into a **single unified 3D Liquid-Glass glyph**:
16
+ 1. **`U` — Outer Liquid-Glass Cradle:** The outer continuous ribbon forms a 3D `U` bowl that holds the entire symbol.
17
+ 2. **`X` — Intersecting Diagonal Blades:** Two crossed diagonal light ribbons (`\ /`) bridge the arms of the `U`.
18
+ 3. **`I` — Central Crystalline Pillar:** A vertical luminescent spine passes directly through the center of the `X` and `U`, crowned with a floating diamond node (`•`).
19
+
20
+ ---
21
+
22
+ ## ✨ Key Architectural Highlights
23
+
24
+ 1. **Liquid Glass & Standard Materials:**
25
+ - **Liquid Glass (`Regular` & `Clear`):** Reserved strictly for the floating navigation and transient control layer (`Sidebar`, `TopHeader`, `CommandPalette`, `SegmentedControl`, `Slider` & `Switch` thumbs).
26
+ - **Standard Materials (`UltraThin`, `Thin`, `Regular`, `Thick`):** Applied to the content layer (`Card`, `DataTable`, KPI panels) with 4-tier **Vibrancy** (`label-primary`, `label-secondary`, `label-tertiary`, `fill-vibrant`).
27
+ 2. **Google Material You (M3) & Live `0px–32px` Border Radius Engine:**
28
+ - **6 Seed Color Palettes:** *Cupertino Blue, Material Iris, Emerald Mint, Sunset Coral, Amber Gold, Graphite Mono* with automatic dark/light tonal adaptation.
29
+ - **Live Corner Geometry (`0px–32px`):** Switch between `Sharp (4px)`, `Squircle (12px)`, `Pill (22px)`, or fine-tune any pixel radius (`0px–32px`) from the TopHeader (`R- | R:12px | R+`), Component Playground, or Theme Studio Drawer.
30
+ - **Global Font Scale (`80%–125%`):** Real-time root `rem` scaling persisted in `localStorage`.
31
+ 3. **Dual Data Table Architecture (`SheetGL` + Native `<DataTable />`):**
32
+ - **`SheetGLGridAdapter` (WebGL/Canvas DataGrid):** Includes **4 enterprise scenarios** (*SaaS & Enterprise Finance*, *AI & Cloud Node Telemetry*, *Workforce & Payroll Matrix*, *Global Logistics & SKU Inventory*) with live formula evaluation, sorting, filtering, and CSV export.
33
+ - **Native `<DataTable />`:** Zero-GPU semantic HTML table with **4 visual variants** (`default`, `striped`, `bordered`, `compact`), column sorting, search filtering, and row selection.
34
+ 4. **FileManGL WebGL2 Virtual File System (`FileManGLExplorerAdapter`):**
35
+ - Windows 11 tabbed explorer UX, 3D Spatial View (`webgl_spatial`), Disk Treemap (`webgl_diskmap`), and a 5-layer **NTFS ACL + POSIX (`0755`)** permission engine.
36
+ 5. **Clean HTML5 History API Routing (`RouteService`):**
37
+ - Every navigation item, tab, breadcrumb, and component renders as a semantic `<a href="...">` with clean URLs (`/`, `/dashboard/*`, `/components/*`, `/docs/*`) and full browser Back/Forward (`popstate`) support.
38
+ 6. **Zero Idle CPU/GPU Resource Footprint & SOLID Principles:**
39
+ - Single-Active-Engine policy ensures only one heavy canvas (`SheetGL` or `FileManGL`) is mounted per view.
40
+ - Strict Dependency Inversion (`ThemeEngineService`, `StorageService`, `RouteService`) and Open/Closed component contracts.
41
+
42
+ ---
43
+
44
+ ## 🔗 Application Route Map
45
+
46
+ | URL Route | View / Module | Description |
47
+ | :--- | :--- | :--- |
48
+ | `/` | `UXILandingPage` | Full-screen `uxiGL` product landing page with live interactive preview & phonetic guide |
49
+ | `/dashboard/overview` | `AppleGoogleAppShowcase` | Command Center Overview (KPIs, neural telemetry, native table & SheetGL summary) |
50
+ | `/dashboard/analytics` | `AppleGoogleAppShowcase` | Live Analytics & Regional Performance Matrix |
51
+ | `/dashboard/crm-orders` | `SheetGLGridAdapter` | Full-page SheetGL (4 enterprise presets) + Native `<DataTable />` comparison |
52
+ | `/dashboard/file-manager` | `FileManGLExplorerAdapter` | Full-page FileManGL WebGL2 Virtual File System Explorer |
53
+ | `/dashboard/smart-cluster` | `AppleGoogleAppShowcase` | AI Neural Engine Compilation & Hardware Cluster Controls |
54
+ | `/components/inputs/:id` | `InteractivePlayground` | Form Controls (`button`, `input`, `switch`, `checkbox`, `slider`) |
55
+ | `/components/surfaces/:id` | `InteractivePlayground` | Surfaces & Navigation (`card`, `segmented-control`, `tabs-accordion`, `modal-command`) |
56
+ | `/components/feedback/:id` | `InteractivePlayground` | Data & Feedback (`chips-badges`, `progress-avatar`, `datatable-statcard`, `filemangl-explorer`) |
57
+ | `/docs/:topic` | `ArchitectureDocsView` | Interactive Documentation (`getting-started`, `theming-tokens`, `layout-shell`, `cli-shortcuts`) |
58
+
59
+ ---
60
+
61
+ ## 🚀 Quick Start (Single-Command Setup)
62
+
63
+ ### 1. Install `uxiGL` (All-in-One Design System)
64
+
65
+ ```bash
66
+ # SheetGL (WebGL DataGrid), FileManGL (WebGL2 VFS) and Lucide Icons are bundled directly!
67
+ npm install uxigl
68
+ # or: pnpm add uxigl | yarn add uxigl | bun add uxigl
69
+ ```
70
+
71
+ ### 2. Scaffold Ready-to-Use Workspace via NPX
72
+
73
+ ```bash
74
+ # Generates a pre-configured <UXIWorkspace /> component & theme setup
75
+ npx uxigl init
76
+ ```
77
+
78
+ ### 3. Usage Example
79
+
80
+ ```tsx
81
+ import React from 'react';
82
+ import {
83
+ ThemeProvider,
84
+ ToastProvider,
85
+ Button,
86
+ Card,
87
+ SheetGLGridAdapter,
88
+ FileManGLExplorerAdapter,
89
+ } from 'uxigl';
90
+ import 'uxigl/styles';
91
+
92
+ export default function App() {
93
+ return (
94
+ <ThemeProvider defaultTheme="system" defaultRadius={12}>
95
+ <ToastProvider>
96
+ <Card variant="glass" title="uxiGL Enterprise Dashboard">
97
+ <SheetGLGridAdapter scenario="saas_finance" />
98
+ </Card>
99
+ </ToastProvider>
100
+ </ThemeProvider>
101
+ );
102
+ }
103
+ ```
104
+
105
+ ### 4. Local Development & NPM Library Build
106
+
107
+ ```bash
108
+ # Start Vite development server
109
+ npm run dev
110
+
111
+ # Build both demo SPA (dist/index.html) and npm library bundle (dist/lib)
112
+ npm run build
113
+
114
+ # Or compile the npm library & TypeScript declarations only
115
+ npm run build:lib
116
+
117
+ # Run package diagnostics
118
+ npm run doctor
119
+ ```
120
+
121
+ ---
122
+
123
+ ## 📄 License
124
+
125
+ MIT License • Crafted with ❤️ by [Trunçgil Teknoloji](https://www.truncgil.com)
package/bin/cli.mjs ADDED
@@ -0,0 +1,410 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import { spawnSync } from 'node:child_process';
6
+ import { fileURLToPath } from 'node:url';
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+ const pkgRoot = path.resolve(__dirname, '..');
11
+
12
+ const CYAN = '\x1b[36m';
13
+ const GREEN = '\x1b[32m';
14
+ const YELLOW = '\x1b[33m';
15
+ const BOLD = '\x1b[1m';
16
+ const DIM = '\x1b[2m';
17
+ const RESET = '\x1b[0m';
18
+
19
+ function readPkgVersion() {
20
+ try {
21
+ const pkg = JSON.parse(fs.readFileSync(path.join(pkgRoot, 'package.json'), 'utf8'));
22
+ return pkg.version || '2.5.1';
23
+ } catch {
24
+ return '2.5.1';
25
+ }
26
+ }
27
+
28
+ function printBanner() {
29
+ const version = readPkgVersion();
30
+ console.log(`
31
+ ${CYAN}${BOLD} ╔══════════════════════════════════════════════════════════════════════╗
32
+ ║ ⚡ uxiGL v${version} — Liquid Glass & Google Material You Design System ║
33
+ ║ SheetGL (WebGL DataGrid) + FileManGL (WebGL2 VFS) Unified Suite ║
34
+ ╚══════════════════════════════════════════════════════════════════════╝${RESET}
35
+ `);
36
+ }
37
+
38
+ function printHelp() {
39
+ printBanner();
40
+ console.log(`${BOLD}Usage:${RESET}
41
+ npx uxigl <command> [options]
42
+ npmx uxigl <command> [options]
43
+
44
+ ${BOLD}Commands:${RESET}
45
+ ${GREEN}init${RESET} [target-file] Generate a ready-to-use <UXIWorkspace /> component in your React project
46
+ (Default: src/components/UXIWorkspace.tsx)
47
+ ${GREEN}create${RESET} <project-name> Scaffold a new Vite + React + TypeScript + uxiGL starter app
48
+ ${GREEN}demo${RESET} Launch the interactive uxiGL Showcase & Documentation server
49
+ ${GREEN}doctor${RESET} Verify Node.js, build artifacts, styles, and environment readiness
50
+ ${GREEN}help${RESET} Show this help message
51
+
52
+ ${BOLD}Single-Command Installation:${RESET}
53
+ ${DIM}# npm / pnpm / yarn / bun (SheetGL & FileManGL included):${RESET}
54
+ npm install uxigl
55
+ pnpm add uxigl
56
+ yarn add uxigl
57
+ bun add uxigl
58
+
59
+ ${BOLD}CLI Examples:${RESET}
60
+ ${DIM}# 1. Generate ready-to-use UXIWorkspace.tsx component:${RESET}
61
+ npx uxigl init
62
+
63
+ ${DIM}# 2. Scaffold a brand-new starter project:${RESET}
64
+ npx uxigl create my-uxigl-app
65
+ `);
66
+ }
67
+
68
+ const STARTER_COMPONENT_TEMPLATE = `import React, { useState } from 'react';
69
+ import {
70
+ ThemeProvider,
71
+ ToastProvider,
72
+ Card,
73
+ Button,
74
+ Input,
75
+ Badge,
76
+ Switch,
77
+ SheetGLGridAdapter,
78
+ FileManGLExplorerAdapter,
79
+ UXILogo,
80
+ } from 'uxigl';
81
+ import 'uxigl/styles';
82
+
83
+ export function UXIWorkspace() {
84
+ const [activeTab, setActiveTab] = useState<'overview' | 'sheet' | 'files'>('overview');
85
+ const [metricEnabled, setMetricEnabled] = useState(true);
86
+
87
+ return (
88
+ <ThemeProvider defaultTheme="system" defaultRadius={12}>
89
+ <ToastProvider>
90
+ <div
91
+ style={{
92
+ minHeight: '100vh',
93
+ padding: '24px',
94
+ backgroundColor: 'var(--uxu-surface-base)',
95
+ color: 'var(--uxu-text-primary)',
96
+ fontFamily: 'var(--uxu-font-sans)',
97
+ display: 'flex',
98
+ flexDirection: 'column',
99
+ gap: 20,
100
+ }}
101
+ >
102
+ {/* Top Control Bar */}
103
+ <header
104
+ style={{
105
+ display: 'flex',
106
+ alignItems: 'center',
107
+ justifyContent: 'space-between',
108
+ padding: '14px 20px',
109
+ borderRadius: 'var(--uxu-radius-lg)',
110
+ backgroundColor: 'var(--uxu-surface-glass-regular)',
111
+ border: '1px solid var(--uxu-border-subtle)',
112
+ backdropFilter: 'blur(20px)',
113
+ }}
114
+ >
115
+ <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
116
+ <UXILogo size={36} animated />
117
+ <div>
118
+ <h1 style={{ margin: 0, fontSize: '1.2rem', fontWeight: 800 }}>uxiGL Unified Workspace</h1>
119
+ <p style={{ margin: 0, fontSize: '0.78rem', color: 'var(--uxu-text-secondary)' }}>
120
+ Liquid Glass & M3 Design System with WebGL Accelerators
121
+ </p>
122
+ </div>
123
+ </div>
124
+
125
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
126
+ <Button
127
+ variant={activeTab === 'overview' ? 'primary' : 'ghost'}
128
+ size="sm"
129
+ onClick={() => setActiveTab('overview')}
130
+ >
131
+ Genel Bakış
132
+ </Button>
133
+ <Button
134
+ variant={activeTab === 'sheet' ? 'primary' : 'ghost'}
135
+ size="sm"
136
+ onClick={() => setActiveTab('sheet')}
137
+ >
138
+ SheetGL (DataGrid)
139
+ </Button>
140
+ <Button
141
+ variant={activeTab === 'files' ? 'primary' : 'ghost'}
142
+ size="sm"
143
+ onClick={() => setActiveTab('files')}
144
+ >
145
+ FileManGL (VFS)
146
+ </Button>
147
+ </div>
148
+ </header>
149
+
150
+ {/* Active View */}
151
+ {activeTab === 'overview' && (
152
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))', gap: 16 }}>
153
+ <Card variant="glass" title="uxiGL Tasarım Sistemi">
154
+ <p style={{ fontSize: '0.88rem', color: 'var(--uxu-text-secondary)', lineHeight: 1.5 }}>
155
+ Liquid Glass tabakası, canlı 0px–32px köşe geometrisi ve Google Material You tonal renk paletleri.
156
+ </p>
157
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginTop: 14 }}>
158
+ <Badge variant="success">Hazır</Badge>
159
+ <Badge variant="info">v2.5.1</Badge>
160
+ <Badge variant="default">WebGL Hızlandırmalı</Badge>
161
+ </div>
162
+ </Card>
163
+
164
+ <Card variant="glass" title="Bileşen Örnekleri">
165
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
166
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
167
+ <span style={{ fontSize: '0.88rem' }}>Donanım Hızlandırması</span>
168
+ <Switch checked={metricEnabled} onChange={setMetricEnabled} />
169
+ </div>
170
+ <Input placeholder="Hızlı komut veya arama filtresi..." />
171
+ </div>
172
+ </Card>
173
+ </div>
174
+ )}
175
+
176
+ {activeTab === 'sheet' && (
177
+ <div style={{ height: '680px', borderRadius: 'var(--uxu-radius-lg)', overflow: 'hidden' }}>
178
+ <SheetGLGridAdapter scenario="saas_finance" />
179
+ </div>
180
+ )}
181
+
182
+ {activeTab === 'files' && (
183
+ <div style={{ height: '680px', borderRadius: 'var(--uxu-radius-lg)', overflow: 'hidden' }}>
184
+ <FileManGLExplorerAdapter initialPath="/workspace/projects" />
185
+ </div>
186
+ )}
187
+ </div>
188
+ </ToastProvider>
189
+ </ThemeProvider>
190
+ );
191
+ }
192
+
193
+ export default UXIWorkspace;
194
+ `;
195
+
196
+ function handleInit(rawArgs) {
197
+ printBanner();
198
+ let dirOpt = null;
199
+ let nameOpt = null;
200
+ let positionalPath = null;
201
+
202
+ for (let i = 0; i < rawArgs.length; i++) {
203
+ const arg = rawArgs[i];
204
+ if (arg === '--dir' || arg === '-d') {
205
+ dirOpt = rawArgs[++i];
206
+ } else if (arg === '--name' || arg === '-n') {
207
+ nameOpt = rawArgs[++i];
208
+ } else if (!arg.startsWith('-') && !positionalPath) {
209
+ positionalPath = arg;
210
+ }
211
+ }
212
+
213
+ const componentName = (nameOpt || 'UXIWorkspace').replace(/\.(tsx|ts|jsx|js)$/i, '');
214
+ const defaultRelPath = path.join(dirOpt || 'src/components', `${componentName}.tsx`);
215
+ const outPath = path.resolve(process.cwd(), positionalPath || defaultRelPath);
216
+ const outDir = path.dirname(outPath);
217
+
218
+ if (!fs.existsSync(outDir)) {
219
+ fs.mkdirSync(outDir, { recursive: true });
220
+ }
221
+
222
+ const customizedTemplate = STARTER_COMPONENT_TEMPLATE.replace(/UXIWorkspace/g, componentName);
223
+
224
+ fs.writeFileSync(outPath, customizedTemplate, 'utf8');
225
+ console.log(`${GREEN}✔ Created uxiGL starter component at:${RESET} ${BOLD}${outPath}${RESET}`);
226
+ console.log(`
227
+ ${BOLD}Next steps:${RESET}
228
+ 1. Ensure ${CYAN}uxigl${RESET} is installed in your project:
229
+ ${YELLOW}npm install uxigl${RESET}
230
+ 2. Import and render ${CYAN}<${componentName} />${RESET} in your ${BOLD}App.tsx${RESET}:
231
+ ${DIM}import { ${componentName} } from './components/${componentName}';${RESET}
232
+ `);
233
+ }
234
+
235
+ function handleCreate(projectName) {
236
+ printBanner();
237
+ if (!projectName) {
238
+ console.error(`${YELLOW}⚠ Please specify a project directory name:${RESET}\n npx uxigl create my-uxigl-app`);
239
+ process.exit(1);
240
+ }
241
+
242
+ const targetDir = path.resolve(process.cwd(), projectName);
243
+ if (fs.existsSync(targetDir) && fs.readdirSync(targetDir).length > 0) {
244
+ console.error(`${YELLOW}⚠ Target directory "${projectName}" already exists and is not empty.${RESET}`);
245
+ process.exit(1);
246
+ }
247
+
248
+ fs.mkdirSync(path.join(targetDir, 'src', 'components'), { recursive: true });
249
+
250
+ const appPkg = {
251
+ name: projectName.toLowerCase().replace(/[^a-z0-9-_]/g, '-'),
252
+ private: true,
253
+ version: '0.1.0',
254
+ type: 'module',
255
+ scripts: {
256
+ dev: 'vite',
257
+ build: 'tsc && vite build',
258
+ preview: 'vite preview',
259
+ },
260
+ dependencies: {
261
+ uxigl: `^${readPkgVersion()}`,
262
+ react: '^19.0.0',
263
+ 'react-dom': '^19.0.0',
264
+ },
265
+ devDependencies: {
266
+ '@types/react': '^19.0.0',
267
+ '@types/react-dom': '^19.0.0',
268
+ '@vitejs/plugin-react': '^4.3.4',
269
+ typescript: '~5.7.2',
270
+ vite: '^6.2.0',
271
+ },
272
+ };
273
+
274
+ fs.writeFileSync(path.join(targetDir, 'package.json'), JSON.stringify(appPkg, null, 2), 'utf8');
275
+ fs.writeFileSync(
276
+ path.join(targetDir, 'index.html'),
277
+ `<!doctype html>
278
+ <html lang="tr" class="dark">
279
+ <head>
280
+ <meta charset="UTF-8" />
281
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
282
+ <title>${projectName} — uxiGL</title>
283
+ <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap" rel="stylesheet" />
284
+ </head>
285
+ <body style="margin:0;padding:0;background:#06080e;color:#f8fafc;">
286
+ <div id="root"></div>
287
+ <script type="module" src="/src/main.tsx"></script>
288
+ </body>
289
+ </html>
290
+ `,
291
+ 'utf8'
292
+ );
293
+
294
+ fs.writeFileSync(
295
+ path.join(targetDir, 'vite.config.ts'),
296
+ `import { defineConfig } from 'vite';
297
+ import react from '@vitejs/plugin-react';
298
+
299
+ export default defineConfig({
300
+ plugins: [react()],
301
+ });
302
+ `,
303
+ 'utf8'
304
+ );
305
+
306
+ fs.writeFileSync(
307
+ path.join(targetDir, 'tsconfig.json'),
308
+ JSON.stringify(
309
+ {
310
+ compilerOptions: {
311
+ target: 'ES2022',
312
+ lib: ['ES2022', 'DOM', 'DOM.Iterable'],
313
+ module: 'ESNext',
314
+ moduleResolution: 'bundler',
315
+ jsx: 'react-jsx',
316
+ strict: true,
317
+ skipLibCheck: true,
318
+ noEmit: true,
319
+ },
320
+ include: ['src'],
321
+ },
322
+ null,
323
+ 2
324
+ ),
325
+ 'utf8'
326
+ );
327
+
328
+ fs.writeFileSync(
329
+ path.join(targetDir, 'src', 'components', 'UXIWorkspace.tsx'),
330
+ STARTER_COMPONENT_TEMPLATE,
331
+ 'utf8'
332
+ );
333
+ fs.writeFileSync(
334
+ path.join(targetDir, 'src', 'App.tsx'),
335
+ `import React from 'react';
336
+ import { UXIWorkspace } from './components/UXIWorkspace';
337
+
338
+ export default function App() {
339
+ return <UXIWorkspace />;
340
+ }
341
+ `,
342
+ 'utf8'
343
+ );
344
+ fs.writeFileSync(
345
+ path.join(targetDir, 'src', 'main.tsx'),
346
+ `import React from 'react';
347
+ import ReactDOM from 'react-dom/client';
348
+ import App from './App';
349
+
350
+ ReactDOM.createRoot(document.getElementById('root')!).render(
351
+ <React.StrictMode>
352
+ <App />
353
+ </React.StrictMode>
354
+ );
355
+ `,
356
+ 'utf8'
357
+ );
358
+
359
+ console.log(`${GREEN}✔ Scaffolded new uxiGL project in:${RESET} ${BOLD}${targetDir}${RESET}\n`);
360
+ console.log(`${BOLD}Run the following commands to start:${RESET}
361
+ ${CYAN}cd ${projectName}${RESET}
362
+ ${CYAN}npm install${RESET}
363
+ ${CYAN}npm run dev${RESET}
364
+ `);
365
+ }
366
+
367
+ function handleDoctor() {
368
+ printBanner();
369
+ const esmBundle = path.join(pkgRoot, 'dist', 'lib', 'uxigl.js');
370
+ const cjsBundle = path.join(pkgRoot, 'dist', 'lib', 'uxigl.cjs');
371
+ const cssBundle = path.join(pkgRoot, 'dist', 'lib', 'style.css');
372
+ const dtsBundle = path.join(pkgRoot, 'dist', 'lib', 'types', 'index.d.ts');
373
+ const demoIndex = path.join(pkgRoot, 'dist', 'index.html');
374
+
375
+ console.log(`${BOLD}Environment & Package Diagnostics:${RESET}`);
376
+ console.log(` • Node.js Runtime : ${GREEN}${process.version}${RESET}`);
377
+ console.log(` • Platform / Arch : ${process.platform} (${process.arch})`);
378
+ console.log(` • ESM Library : ${fs.existsSync(esmBundle) ? `${GREEN}✔ Ready (dist/lib/uxigl.js)${RESET}` : `${YELLOW}⚠ Missing (run npm run build:lib)${RESET}`}`);
379
+ console.log(` • CJS Library : ${fs.existsSync(cjsBundle) ? `${GREEN}✔ Ready (dist/lib/uxigl.cjs)${RESET}` : `${YELLOW}⚠ Missing (run npm run build:lib)${RESET}`}`);
380
+ console.log(` • CSS Stylesheet : ${fs.existsSync(cssBundle) ? `${GREEN}✔ Ready (dist/lib/style.css)${RESET}` : `${YELLOW}⚠ Missing (run npm run build:lib)${RESET}`}`);
381
+ console.log(` • TypeScript .d.ts: ${fs.existsSync(dtsBundle) ? `${GREEN}✔ Ready (dist/lib/types/index.d.ts)${RESET}` : `${YELLOW}⚠ Missing (run npm run build:lib)${RESET}`}`);
382
+ console.log(` • Demo SPA Bundle : ${fs.existsSync(demoIndex) ? `${GREEN}✔ Ready (dist/index.html)${RESET}` : `${YELLOW}⚠ Missing (run npm run build:demo)${RESET}`}`);
383
+ console.log('');
384
+ }
385
+
386
+ function handleDemo() {
387
+ printBanner();
388
+ console.log(`${CYAN}Starting uxiGL Showcase & Documentation server...${RESET}\n`);
389
+ spawnSync('npx', ['vite'], { cwd: pkgRoot, stdio: 'inherit', shell: true });
390
+ }
391
+
392
+ const args = process.argv.slice(2);
393
+ const invokedBin = path.basename(process.argv[1] || '');
394
+ const cmd = (args[0] || 'help').toLowerCase();
395
+
396
+ if (invokedBin.includes('create-uxigl') && args[0] && !['init', 'create', 'doctor', 'demo', 'help', '-v', '--version'].includes(cmd)) {
397
+ handleCreate(args[0]);
398
+ } else if (cmd === 'init' || cmd === 'setup') {
399
+ handleInit(args.slice(1));
400
+ } else if (cmd === 'create') {
401
+ handleCreate(args[1]);
402
+ } else if (cmd === 'doctor' || cmd === 'info' || cmd === 'check') {
403
+ handleDoctor();
404
+ } else if (cmd === 'demo' || cmd === 'studio' || cmd === 'start') {
405
+ handleDemo();
406
+ } else if (cmd === '-v' || cmd === '--version' || cmd === 'version') {
407
+ console.log(readPkgVersion());
408
+ } else {
409
+ printHelp();
410
+ }