omnira-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +145 -0
- package/cli/omnira-init.mjs +260 -0
- package/cli/presets.mjs +386 -0
- package/components/ui/AppStoreButton/AppStoreButton.module.css +87 -0
- package/components/ui/AppStoreButton/AppStoreButton.tsx +114 -0
- package/components/ui/AppStoreButton/index.ts +2 -0
- package/components/ui/Avatar/Avatar.module.css +76 -0
- package/components/ui/Avatar/Avatar.tsx +102 -0
- package/components/ui/Avatar/index.ts +2 -0
- package/components/ui/Badge/Badge.module.css +120 -0
- package/components/ui/Badge/Badge.tsx +25 -0
- package/components/ui/Badge/index.ts +2 -0
- package/components/ui/BadgeGroup/BadgeGroup.module.css +214 -0
- package/components/ui/BadgeGroup/BadgeGroup.tsx +88 -0
- package/components/ui/BadgeGroup/index.ts +2 -0
- package/components/ui/Browser/Browser.module.css +105 -0
- package/components/ui/Browser/Browser.tsx +54 -0
- package/components/ui/Browser/index.ts +2 -0
- package/components/ui/Button/Button.module.css +188 -0
- package/components/ui/Button/Button.tsx +74 -0
- package/components/ui/Button/index.ts +2 -0
- package/components/ui/ButtonUtility/ButtonUtility.module.css +154 -0
- package/components/ui/ButtonUtility/ButtonUtility.tsx +65 -0
- package/components/ui/ButtonUtility/index.ts +2 -0
- package/components/ui/Card/Card.module.css +80 -0
- package/components/ui/Card/Card.tsx +39 -0
- package/components/ui/Card/index.ts +2 -0
- package/components/ui/Checkbox/Checkbox.module.css +92 -0
- package/components/ui/Checkbox/Checkbox.tsx +95 -0
- package/components/ui/Checkbox/index.ts +2 -0
- package/components/ui/Collapse/Collapse.module.css +60 -0
- package/components/ui/Collapse/Collapse.tsx +100 -0
- package/components/ui/Collapse/index.ts +2 -0
- package/components/ui/CreditCard/CreditCard.module.css +117 -0
- package/components/ui/CreditCard/CreditCard.tsx +86 -0
- package/components/ui/CreditCard/index.ts +2 -0
- package/components/ui/Dropdown/Dropdown.module.css +269 -0
- package/components/ui/Dropdown/Dropdown.tsx +419 -0
- package/components/ui/Dropdown/index.ts +31 -0
- package/components/ui/GridLines/GridLines.module.css +95 -0
- package/components/ui/GridLines/GridLines.tsx +10 -0
- package/components/ui/GridLines/index.ts +1 -0
- package/components/ui/Illustration/Illustration.module.css +10 -0
- package/components/ui/Illustration/Illustration.tsx +96 -0
- package/components/ui/Illustration/index.ts +2 -0
- package/components/ui/Input/Input.module.css +217 -0
- package/components/ui/Input/Input.tsx +93 -0
- package/components/ui/Input/index.ts +2 -0
- package/components/ui/Phone/Phone.module.css +104 -0
- package/components/ui/Phone/Phone.tsx +54 -0
- package/components/ui/Phone/index.ts +2 -0
- package/components/ui/PinInput/PinInput.module.css +104 -0
- package/components/ui/PinInput/PinInput.tsx +210 -0
- package/components/ui/PinInput/index.ts +1 -0
- package/components/ui/ProgressBar/ProgressBar.module.css +180 -0
- package/components/ui/ProgressBar/ProgressBar.tsx +206 -0
- package/components/ui/ProgressBar/index.ts +2 -0
- package/components/ui/QRCode/QRCode.module.css +13 -0
- package/components/ui/QRCode/QRCode.tsx +128 -0
- package/components/ui/QRCode/index.ts +2 -0
- package/components/ui/RadioButton/RadioButton.module.css +92 -0
- package/components/ui/RadioButton/RadioButton.tsx +134 -0
- package/components/ui/RadioButton/index.ts +2 -0
- package/components/ui/RadioGroup/RadioGroup.module.css +382 -0
- package/components/ui/RadioGroup/RadioGroup.tsx +292 -0
- package/components/ui/RadioGroup/index.ts +1 -0
- package/components/ui/Rating/Rating.module.css +99 -0
- package/components/ui/Rating/Rating.tsx +123 -0
- package/components/ui/Rating/index.ts +2 -0
- package/components/ui/Select/Select.module.css +371 -0
- package/components/ui/Select/Select.tsx +507 -0
- package/components/ui/Select/index.ts +2 -0
- package/components/ui/SidebarNavigation/SidebarDual.tsx +71 -0
- package/components/ui/SidebarNavigation/SidebarFeatureCard.module.css +351 -0
- package/components/ui/SidebarNavigation/SidebarFeatureCard.tsx +388 -0
- package/components/ui/SidebarNavigation/SidebarNavigation.module.css +610 -0
- package/components/ui/SidebarNavigation/SidebarParts.tsx +215 -0
- package/components/ui/SidebarNavigation/SidebarSectionDividers.tsx +46 -0
- package/components/ui/SidebarNavigation/SidebarSectionHeadings.tsx +52 -0
- package/components/ui/SidebarNavigation/SidebarSimple.tsx +46 -0
- package/components/ui/SidebarNavigation/SidebarSlim.tsx +48 -0
- package/components/ui/SidebarNavigation/index.ts +29 -0
- package/components/ui/SidebarNavigation/types.ts +27 -0
- package/components/ui/Slider/Slider.module.css +93 -0
- package/components/ui/Slider/Slider.tsx +118 -0
- package/components/ui/Slider/index.ts +2 -0
- package/components/ui/SocialButton/SocialButton.module.css +223 -0
- package/components/ui/SocialButton/SocialButton.tsx +185 -0
- package/components/ui/SocialButton/index.ts +2 -0
- package/components/ui/Tag/Tag.module.css +203 -0
- package/components/ui/Tag/Tag.tsx +161 -0
- package/components/ui/Tag/index.ts +2 -0
- package/components/ui/TextEditor/TextEditor.module.css +182 -0
- package/components/ui/TextEditor/TextEditor.tsx +323 -0
- package/components/ui/TextEditor/index.ts +1 -0
- package/components/ui/Textarea/Textarea.module.css +75 -0
- package/components/ui/Textarea/Textarea.tsx +59 -0
- package/components/ui/Textarea/index.ts +2 -0
- package/components/ui/Toggle/Toggle.module.css +118 -0
- package/components/ui/Toggle/Toggle.tsx +77 -0
- package/components/ui/Toggle/index.ts +2 -0
- package/components/ui/Tooltip/Tooltip.module.css +95 -0
- package/components/ui/Tooltip/Tooltip.tsx +55 -0
- package/components/ui/Tooltip/index.ts +2 -0
- package/components/ui/VideoPlayer/VideoPlayer.module.css +120 -0
- package/components/ui/VideoPlayer/VideoPlayer.tsx +229 -0
- package/components/ui/VideoPlayer/index.ts +2 -0
- package/lib/cn.ts +3 -0
- package/lib/copy-to-clipboard.ts +21 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Omnira UI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Omnira UI
|
|
2
|
+
|
|
3
|
+
A premium glassmorphism design system — dark-first, glass-forward, no compromises.
|
|
4
|
+
|
|
5
|
+
30+ base components, sidebar navigation, feature cards, 1,000+ icons, and a CLI to scaffold your project with your chosen accent color and theme mode.
|
|
6
|
+
|
|
7
|
+
**[Live Documentation →](https://ui.omnira.space)**
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### 1. Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install omnira-ui
|
|
17
|
+
# or
|
|
18
|
+
pnpm add omnira-ui
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 2. Initialize your project
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx omnira-ui init
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The CLI walks you through:
|
|
28
|
+
- **Project name**
|
|
29
|
+
- **Accent color** — 10 presets: Lime (default), Blue, Cyan, Green, Orange, Pink, Purple, Red, Teal, Yellow
|
|
30
|
+
- **Theme mode** — Dark-first or Light-first
|
|
31
|
+
|
|
32
|
+
It generates `omnira.config.ts` and `omnira-overrides.css` ready to import in your root layout.
|
|
33
|
+
|
|
34
|
+
### 3. Use components
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { Button } from "omnira-ui/components/ui/Button";
|
|
38
|
+
import { Badge } from "omnira-ui/components/ui/Badge";
|
|
39
|
+
import { Input } from "omnira-ui/components/ui/Input";
|
|
40
|
+
|
|
41
|
+
export default function MyPage() {
|
|
42
|
+
return (
|
|
43
|
+
<div>
|
|
44
|
+
<Button variant="primary" size="md">Get Started</Button>
|
|
45
|
+
<Badge variant="success" dot>Online</Badge>
|
|
46
|
+
<Input label="Email" placeholder="you@example.com" />
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Components
|
|
55
|
+
|
|
56
|
+
### Base Components (30+)
|
|
57
|
+
|
|
58
|
+
| Component | Description |
|
|
59
|
+
|-----------|-------------|
|
|
60
|
+
| **Button** | Primary, secondary, tertiary, ghost, accent — 4 sizes, loading states, icon support |
|
|
61
|
+
| **Input** | Text, password, search — leading/trailing icons, dropdowns, copy-to-clipboard |
|
|
62
|
+
| **Badge** | 6 semantic variants with dot indicators and 3 sizes |
|
|
63
|
+
| **Select** | Fully accessible dropdown with keyboard navigation |
|
|
64
|
+
| **Dropdown** | Menu dropdown with items, dividers, and icons |
|
|
65
|
+
| **Toggle** | On/off switch with labels |
|
|
66
|
+
| **Checkbox** | Single checkbox with indeterminate state |
|
|
67
|
+
| **Radio Button / Radio Group** | Single and grouped radio controls |
|
|
68
|
+
| **Slider** | Range selection with custom tracks |
|
|
69
|
+
| **Rating** | Star-based rating with half-star support |
|
|
70
|
+
| **Tag** | Dismissible tags with variants |
|
|
71
|
+
| **Tooltip** | Positioned tooltips with arrow indicators |
|
|
72
|
+
| **Collapse** | Animated accordion panels |
|
|
73
|
+
| **Textarea** | Multi-line text input |
|
|
74
|
+
| **Text Editor** | Rich text input with formatting toolbar |
|
|
75
|
+
| **Progress Indicator** | Bars and circular progress |
|
|
76
|
+
| **Avatar** | Image, initials, and status indicators |
|
|
77
|
+
| **Credit Card** | Visual card component with formatting |
|
|
78
|
+
| **QR Code** | Scannable QR generation |
|
|
79
|
+
| **Phone** | International phone number input |
|
|
80
|
+
| **Verification Code Input** | OTP-style pin entry |
|
|
81
|
+
| **Video Player** | Custom-styled media player |
|
|
82
|
+
| **Browser** | Chrome-style browser frame mockup |
|
|
83
|
+
| **App Store Button** | iOS and Android download buttons |
|
|
84
|
+
| **Social Button** | OAuth provider buttons (Google, GitHub, etc.) |
|
|
85
|
+
| **Illustration** | Decorative SVG components |
|
|
86
|
+
| **Badge Group** | Grouped badge layouts |
|
|
87
|
+
| **Button Group** | Connected button sets |
|
|
88
|
+
| **Featured Icon** | Highlighted icon containers |
|
|
89
|
+
|
|
90
|
+
### Application UI
|
|
91
|
+
|
|
92
|
+
- **Sidebar Navigation** — 5 variants: Simple, Section Dividers, Section Headings, Slim (icon-only), Dual Panel
|
|
93
|
+
- **12 Feature Cards** — Progress, Storage, Image Banner, Cookie Consent, Referral, Onboarding, Upgrade, Support, Event, Message, Current Project, Free Trial
|
|
94
|
+
- **User Account Menu** — Popup with profile, settings, account switching, sign out
|
|
95
|
+
- **Search Bar** — Integrated ⌘K search component
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Design System
|
|
100
|
+
|
|
101
|
+
- **Dark-first** — Every surface designed in dark mode first, then adapted to light
|
|
102
|
+
- **Glassmorphism** — Frosted glass surfaces with backdrop blur and layered depth
|
|
103
|
+
- **Lime accent** — `#D2FE17` (dark) / `#8AB400` (light), or choose from 10 presets
|
|
104
|
+
- **CSS Custom Properties** — Every design token is a CSS variable you own
|
|
105
|
+
- **`data-theme` switching** — Smooth 0.4s transitions between dark and light
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Tech Stack
|
|
110
|
+
|
|
111
|
+
- **Next.js 16+** (App Router) + **TypeScript**
|
|
112
|
+
- **CSS Modules** + **CSS Custom Properties** (no Tailwind)
|
|
113
|
+
- **iconsax-react** (Bulk variant) — 1,000+ icons
|
|
114
|
+
- **Framer Motion** for animations
|
|
115
|
+
- **Host Grotesk** (display) + **Rubik** (body) typography
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Development
|
|
120
|
+
|
|
121
|
+
Clone the repo and run the documentation site locally:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
git clone https://github.com/nidrosoft/omniraui.git
|
|
125
|
+
cd omniraui
|
|
126
|
+
pnpm install
|
|
127
|
+
pnpm dev
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Open [http://localhost:3000](http://localhost:3000) to view the docs.
|
|
131
|
+
|
|
132
|
+
### Project Structure
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
components/ui/ # Component library source (published to npm)
|
|
136
|
+
cli/ # CLI tool (published to npm)
|
|
137
|
+
app/ # Documentation site (Next.js App Router)
|
|
138
|
+
lib/ # Shared utilities
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
MIT © [Omnira UI](https://ui.omnira.space)
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Omnira UI — Interactive Setup CLI
|
|
5
|
+
*
|
|
6
|
+
* Usage: npx omnira-ui init
|
|
7
|
+
* node cli/omnira-init.mjs
|
|
8
|
+
*
|
|
9
|
+
* Walks the user through project naming, accent color selection,
|
|
10
|
+
* and theme mode — then generates omnira.config.ts and a CSS
|
|
11
|
+
* overrides file ready to import.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import * as readline from "node:readline";
|
|
15
|
+
import * as fs from "node:fs";
|
|
16
|
+
import * as path from "node:path";
|
|
17
|
+
import { COLOR_PRESETS, DEFAULT_COLOR, DEFAULT_THEME, THEME_MODES } from "./presets.mjs";
|
|
18
|
+
|
|
19
|
+
// ── Helpers ──────────────────────────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
const RESET = "\x1b[0m";
|
|
22
|
+
const BOLD = "\x1b[1m";
|
|
23
|
+
const DIM = "\x1b[2m";
|
|
24
|
+
const GREEN = "\x1b[32m";
|
|
25
|
+
const CYAN = "\x1b[36m";
|
|
26
|
+
const YELLOW = "\x1b[33m";
|
|
27
|
+
const MAGENTA = "\x1b[35m";
|
|
28
|
+
const WHITE = "\x1b[97m";
|
|
29
|
+
|
|
30
|
+
function colorize(hex) {
|
|
31
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
32
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
33
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
34
|
+
return `\x1b[38;2;${r};${g};${b}m`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function log(msg = "") {
|
|
38
|
+
process.stdout.write(msg + "\n");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function blank() {
|
|
42
|
+
log();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ── Readline prompt ──────────────────────────────────────────────────
|
|
46
|
+
|
|
47
|
+
function createPrompt() {
|
|
48
|
+
const rl = readline.createInterface({
|
|
49
|
+
input: process.stdin,
|
|
50
|
+
output: process.stdout,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
function ask(question) {
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
|
+
rl.question(question, (answer) => resolve(answer.trim()));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function close() {
|
|
60
|
+
rl.close();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return { ask, close };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ── Color picker (interactive list) ─────────────────────────────────
|
|
67
|
+
|
|
68
|
+
async function pickColor(promptFn) {
|
|
69
|
+
const keys = Object.keys(COLOR_PRESETS);
|
|
70
|
+
|
|
71
|
+
blank();
|
|
72
|
+
log(`${BOLD}${WHITE} Available accent colors:${RESET}`);
|
|
73
|
+
blank();
|
|
74
|
+
|
|
75
|
+
keys.forEach((key, i) => {
|
|
76
|
+
const preset = COLOR_PRESETS[key];
|
|
77
|
+
const swatch = colorize(preset.hex);
|
|
78
|
+
const isDefault = key === DEFAULT_COLOR;
|
|
79
|
+
const suffix = isDefault ? ` ${DIM}(default)${RESET}` : "";
|
|
80
|
+
const num = String(i + 1).padStart(2, " ");
|
|
81
|
+
log(` ${DIM}${num}.${RESET} ${swatch}●${RESET} ${preset.label}${suffix} ${DIM}${preset.hex}${RESET}`);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
blank();
|
|
85
|
+
const answer = await promptFn(` ${CYAN}?${RESET} ${BOLD}Pick a color${RESET} ${DIM}(number or name, default: lime):${RESET} `);
|
|
86
|
+
|
|
87
|
+
if (!answer) return DEFAULT_COLOR;
|
|
88
|
+
|
|
89
|
+
// Match by number
|
|
90
|
+
const num = parseInt(answer, 10);
|
|
91
|
+
if (!isNaN(num) && num >= 1 && num <= keys.length) {
|
|
92
|
+
return keys[num - 1];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Match by name (case-insensitive)
|
|
96
|
+
const lower = answer.toLowerCase();
|
|
97
|
+
if (COLOR_PRESETS[lower]) return lower;
|
|
98
|
+
|
|
99
|
+
// Fuzzy match
|
|
100
|
+
const match = keys.find((k) => k.startsWith(lower) || COLOR_PRESETS[k].label.toLowerCase().startsWith(lower));
|
|
101
|
+
if (match) return match;
|
|
102
|
+
|
|
103
|
+
log(` ${YELLOW}!${RESET} Unknown color "${answer}", using lime.`);
|
|
104
|
+
return DEFAULT_COLOR;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ── Theme mode picker ───────────────────────────────────────────────
|
|
108
|
+
|
|
109
|
+
async function pickTheme(promptFn) {
|
|
110
|
+
blank();
|
|
111
|
+
log(`${BOLD}${WHITE} Theme modes:${RESET}`);
|
|
112
|
+
blank();
|
|
113
|
+
log(` ${DIM} 1.${RESET} Dark-first ${DIM}(default)${RESET}`);
|
|
114
|
+
log(` ${DIM} 2.${RESET} Light-first`);
|
|
115
|
+
blank();
|
|
116
|
+
|
|
117
|
+
const answer = await promptFn(` ${CYAN}?${RESET} ${BOLD}Default theme mode${RESET} ${DIM}(1 or 2, default: 1):${RESET} `);
|
|
118
|
+
|
|
119
|
+
if (!answer || answer === "1" || answer.toLowerCase().startsWith("dark")) return "dark-first";
|
|
120
|
+
if (answer === "2" || answer.toLowerCase().startsWith("light")) return "light-first";
|
|
121
|
+
|
|
122
|
+
log(` ${YELLOW}!${RESET} Unknown option "${answer}", using dark-first.`);
|
|
123
|
+
return DEFAULT_THEME;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ── File generators ─────────────────────────────────────────────────
|
|
127
|
+
|
|
128
|
+
function generateConfig(projectName, colorKey, themeMode) {
|
|
129
|
+
return `/**
|
|
130
|
+
* Omnira UI Configuration
|
|
131
|
+
* Generated by: npx omnira-ui init
|
|
132
|
+
*
|
|
133
|
+
* This file defines your project's Omnira UI settings.
|
|
134
|
+
* Import the generated CSS overrides in your root layout.
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
const omniraConfig = {
|
|
138
|
+
project: "${projectName}",
|
|
139
|
+
accent: "${colorKey}",
|
|
140
|
+
theme: "${themeMode}",
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export default omniraConfig;
|
|
144
|
+
`;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function generateCSS(colorKey, themeMode) {
|
|
148
|
+
const preset = COLOR_PRESETS[colorKey];
|
|
149
|
+
if (!preset) return "";
|
|
150
|
+
|
|
151
|
+
// If lime (default), no overrides needed
|
|
152
|
+
if (colorKey === "lime") {
|
|
153
|
+
return `/**
|
|
154
|
+
* Omnira UI — Theme Overrides
|
|
155
|
+
* Generated by: npx omnira-ui init
|
|
156
|
+
*
|
|
157
|
+
* Accent: ${preset.label} (${preset.hex})
|
|
158
|
+
* Theme: ${themeMode}
|
|
159
|
+
*
|
|
160
|
+
* Using default Lime preset — no overrides needed.
|
|
161
|
+
* Import this file after globals.css in your root layout.
|
|
162
|
+
*/
|
|
163
|
+
`;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
let css = `/**
|
|
167
|
+
* Omnira UI — Theme Overrides
|
|
168
|
+
* Generated by: npx omnira-ui init
|
|
169
|
+
*
|
|
170
|
+
* Accent: ${preset.label} (${preset.hex})
|
|
171
|
+
* Theme: ${themeMode}
|
|
172
|
+
*
|
|
173
|
+
* Import this file after globals.css in your root layout:
|
|
174
|
+
* import "./omnira-overrides.css";
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
`;
|
|
178
|
+
|
|
179
|
+
// Dark overrides
|
|
180
|
+
css += `[data-theme="dark"] {\n`;
|
|
181
|
+
for (const [prop, value] of Object.entries(preset.dark)) {
|
|
182
|
+
css += ` ${prop}: ${value};\n`;
|
|
183
|
+
}
|
|
184
|
+
css += `}\n\n`;
|
|
185
|
+
|
|
186
|
+
// Light overrides
|
|
187
|
+
css += `[data-theme="light"] {\n`;
|
|
188
|
+
for (const [prop, value] of Object.entries(preset.light)) {
|
|
189
|
+
css += ` ${prop}: ${value};\n`;
|
|
190
|
+
}
|
|
191
|
+
css += `}\n`;
|
|
192
|
+
|
|
193
|
+
return css;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ── Main ─────────────────────────────────────────────────────────────
|
|
197
|
+
|
|
198
|
+
async function main() {
|
|
199
|
+
const { ask, close } = createPrompt();
|
|
200
|
+
|
|
201
|
+
blank();
|
|
202
|
+
log(` ${BOLD}${GREEN}✦${RESET} ${BOLD}${WHITE}Omnira UI Setup${RESET}`);
|
|
203
|
+
log(` ${DIM}The premium glassmorphism design system${RESET}`);
|
|
204
|
+
blank();
|
|
205
|
+
|
|
206
|
+
// 1. Project name
|
|
207
|
+
const projectName = (await ask(` ${CYAN}?${RESET} ${BOLD}Project name${RESET} ${DIM}(default: my-app):${RESET} `)) || "my-app";
|
|
208
|
+
|
|
209
|
+
// 2. Accent color
|
|
210
|
+
const colorKey = await pickColor(ask);
|
|
211
|
+
const preset = COLOR_PRESETS[colorKey];
|
|
212
|
+
|
|
213
|
+
// 3. Theme mode
|
|
214
|
+
const themeMode = await pickTheme(ask);
|
|
215
|
+
|
|
216
|
+
close();
|
|
217
|
+
|
|
218
|
+
// ── Summary ──
|
|
219
|
+
blank();
|
|
220
|
+
log(` ${DIM}─────────────────────────────────────${RESET}`);
|
|
221
|
+
blank();
|
|
222
|
+
log(` ${BOLD}${WHITE}Configuration:${RESET}`);
|
|
223
|
+
blank();
|
|
224
|
+
log(` ${DIM}Project:${RESET} ${WHITE}${projectName}${RESET}`);
|
|
225
|
+
log(` ${DIM}Accent:${RESET} ${colorize(preset.hex)}●${RESET} ${preset.label} ${DIM}(${preset.hex})${RESET}`);
|
|
226
|
+
log(` ${DIM}Theme:${RESET} ${WHITE}${themeMode === "dark-first" ? "Dark-first" : "Light-first"}${RESET}`);
|
|
227
|
+
blank();
|
|
228
|
+
|
|
229
|
+
// ── Write files ──
|
|
230
|
+
const cwd = process.cwd();
|
|
231
|
+
const configPath = path.join(cwd, "omnira.config.ts");
|
|
232
|
+
const cssPath = path.join(cwd, "omnira-overrides.css");
|
|
233
|
+
|
|
234
|
+
// Config file
|
|
235
|
+
fs.writeFileSync(configPath, generateConfig(projectName, colorKey, themeMode), "utf-8");
|
|
236
|
+
log(` ${GREEN}✓${RESET} Created ${BOLD}omnira.config.ts${RESET}`);
|
|
237
|
+
|
|
238
|
+
// CSS overrides
|
|
239
|
+
const cssContent = generateCSS(colorKey, themeMode);
|
|
240
|
+
fs.writeFileSync(cssPath, cssContent, "utf-8");
|
|
241
|
+
log(` ${GREEN}✓${RESET} Created ${BOLD}omnira-overrides.css${RESET}`);
|
|
242
|
+
|
|
243
|
+
blank();
|
|
244
|
+
|
|
245
|
+
if (colorKey !== "lime") {
|
|
246
|
+
log(` ${DIM}Import the overrides in your root layout:${RESET}`);
|
|
247
|
+
blank();
|
|
248
|
+
log(` ${MAGENTA}import${RESET} ${WHITE}"./globals.css"${RESET};`);
|
|
249
|
+
log(` ${MAGENTA}import${RESET} ${WHITE}"./omnira-overrides.css"${RESET};`);
|
|
250
|
+
blank();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
log(` ${GREEN}✓${RESET} ${BOLD}${WHITE}Ready to go!${RESET} Run ${CYAN}npx omnira-ui${RESET} to reconfigure anytime.`);
|
|
254
|
+
blank();
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
main().catch((err) => {
|
|
258
|
+
console.error(err);
|
|
259
|
+
process.exit(1);
|
|
260
|
+
});
|