@tuwaio/nova-core 0.1.0 → 0.1.1

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 (2) hide show
  1. package/README.md +216 -24
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -4,48 +4,240 @@
4
4
  [![License](https://img.shields.io/npm/l/@tuwaio/nova-core.svg)](./LICENSE)
5
5
  [![Build Status](https://img.shields.io/github/actions/workflow/status/TuwaIO/nova-uikit/release.yml?branch=main)](https://github.com/TuwaIO/nova-uikit/actions)
6
6
 
7
- The foundational package for the TUWA design system. Provides core styling primitives, theme variables, and common React hooks and utilities.
7
+ The foundational package for the Nova UI Kit design system. Provides core styling primitives, theme variables, utility functions, and common React hooks for building consistent Web3 applications.
8
+
9
+ -----
8
10
 
9
11
  ## What is `@tuwaio/nova-core`?
10
12
 
11
- `@tuwaio/nova-core` is the engine of the TUWA design system. It is **not** a component library. Instead, it provides the low-level tools necessary to build consistent, high-quality user interfaces across all TUWA products.
13
+ `@tuwaio/nova-core` is the **foundational engine** of the Nova UI Kit design system. It is **not** a component library—instead, it provides the low-level tools, design tokens, and utilities necessary to build consistent, high-quality user interfaces across all TUWA products.
14
+
15
+ Built for the **TUWA ecosystem**, Nova Core serves as the shared foundation that powers all other Nova packages (`@tuwaio/nova-connect`, `@tuwaio/nova-transactions`) and ensures design consistency across multi-chain Web3 applications.
16
+
17
+ **Why Nova Core?**
18
+
19
+ Building design systems requires consistent foundations: colors, spacing, typography, and utility functions. Without a shared core, different packages end up with conflicting styles, duplicated code, and inconsistent user experiences.
20
+
21
+ Nova Core solves this by:
22
+
23
+ 1. **Providing Unified Design Tokens:** A comprehensive CSS variable system that ensures visual consistency across all components.
24
+ 2. **Offering Smart Utilities:** Battle-tested helper functions like the `cn` utility that combines `clsx` and `tailwind-merge` for conflict-free styling.
25
+ 3. **Supplying Common Hooks:** A collection of reusable React hooks for common Web3 UI patterns.
26
+ 4. **Ensuring Tailwind CSS v4 Integration:** Seamless compatibility with modern Tailwind CSS workflows.
27
+
28
+ -----
12
29
 
13
- Use this package to:
14
- - Ensure brand consistency with a centralized theme and styling.
15
- - Speed up development with a set of battle-tested helper hooks and utilities.
16
- - Provide a solid foundation for our component library, `@tuwaio/nova-transactions`.
30
+ ## Key Features
17
31
 
18
- ## Core Features
32
+ - **🎨 Complete Design Token System:** Comprehensive CSS variables for colors, spacing, typography, shadows, and animations
33
+ - **🛠️ Smart Utility Functions:** Advanced `cn` utility that merges Tailwind classes intelligently, preventing style conflicts
34
+ - **🎣 Common React Hooks:** Collection of reusable hooks for Web3 UI patterns like wallet state, transaction status, and theme management
35
+ - **⚡ Tailwind CSS v4 Ready:** Full compatibility with modern Tailwind CSS workflows and arbitrary value usage
36
+ - **🌓 Dark Mode Support:** Built-in dark mode theming with CSS variable-based switching
37
+ - **♿ Accessibility First:** ARIA-compliant design tokens and utilities for building accessible interfaces
38
+ - **📱 Responsive Design:** Mobile-first breakpoints and responsive utility functions
19
39
 
20
- - **🎨 Styling Primitives:** A single CSS file containing all TUWA design tokens as CSS variables (e.g., `--tuwa-color-primary`).
21
- - **🛠️ Helper Utilities:** A smart `cn` utility that combines `clsx` and `tailwind-merge` for building dynamic and conflict-free class names.
22
- - **🎣 Common Hooks:** A collection of generic, reusable React hooks for common tasks.
40
+ -----
23
41
 
24
- ## Installation
42
+ ## 💾 Installation
25
43
 
26
- 1. Install the package using your preferred package manager:
44
+ ### Requirements
27
45
 
28
- ```bash
29
- pnpm add @tuwaio/nova-core
30
- ```
46
+ - **React:** 19+
47
+ - **Node.js:** 20+
48
+ - **TypeScript:** 5.9+ (recommended)
31
49
 
32
- 2. **Import the core styles** into the root of your application's main CSS file (e.g., `globals.css`). **This step is crucial.**
50
+ ### Package Installation
33
51
 
34
- ```css
35
- @import '@tuwaio/nova-core/dist/index.css';
36
- ```
52
+ Install the package using your preferred package manager:
37
53
 
38
- ### Usage
54
+ ```bash
55
+ # Using pnpm (recommended)
56
+ pnpm add @tuwaio/nova-core
57
+
58
+ # Using npm
59
+ npm install @tuwaio/nova-core
60
+
61
+ # Using yarn
62
+ yarn add @tuwaio/nova-core
63
+ ```
64
+
65
+ ### CSS Setup
66
+
67
+ **⚠️ Critical Step:** Import the core styles into your application's main CSS file. This step is essential for accessing base styles.
68
+
69
+ ```css
70
+ /* src/styles/globals.css or src/styles/app.css */
71
+ @import '@tuwaio/nova-core/dist/index.css';
72
+ ```
39
73
 
40
- For example with Tailwind CSS v4, you can use the CSS variables from this package directly in your className as arbitrary values only need to @import tailwindcss in your .css file.
74
+ -----
75
+
76
+ ## 🚀 Usage
77
+
78
+ ### Design Tokens with Tailwind CSS v4
79
+
80
+ Nova Core is designed to work seamlessly with Tailwind CSS v4. You can use the CSS variables directly in your `className` as arbitrary values:
41
81
 
42
82
  ```tsx
43
- // You can use the variables directly
44
- <button className="bg-[var(--tuwa-color-primary)] text-[var(--tuwa-color-foreground)] p-[var(--tuwa-spacing-md)]">
45
- Click Me
83
+ // Using Nova design tokens in Tailwind classes
84
+ <button className="bg-[var(--tuwa-color-primary)] text-[var(--tuwa-text-on-primary)]">
85
+ Connect Wallet
46
86
  </button>
87
+
88
+ // With hover states and transitions
89
+ <div className="
90
+ p-[var(--tuwa-spacing-md)]
91
+ bg-[var(--tuwa-bg-secondary)]
92
+ hover:bg-[var(--tuwa-bg-hover)]
93
+ transition-colors
94
+ ">
95
+ Card Content
96
+ </div>
47
97
  ```
48
98
 
99
+ ### The `cn` Utility Function
100
+
101
+ The `cn` utility combines `clsx` and `tailwind-merge` to provide intelligent class merging:
102
+
103
+ ```tsx
104
+ import { cn } from '@tuwaio/nova-core';
105
+
106
+ // Basic usage
107
+ const buttonClass = cn(
108
+ 'px-4 py-2 font-medium rounded-lg', // base styles
109
+ 'bg-blue-500 text-white', // default variant
110
+ {'opacity-50 cursor-not-allowed': isLoading}, // conditional styles
111
+ className // additional classes from props
112
+ );
113
+
114
+ // Tailwind class conflict resolution
115
+ const mergedClasses = cn(
116
+ 'p-4 text-sm', // base classes
117
+ 'p-6 text-lg' // these override the base classes intelligently
118
+ );
119
+ // Result: 'p-6 text-lg' (conflicts resolved)
120
+ ```
121
+
122
+ ### Common React Hooks
123
+
124
+ Nova Core provides several utility hooks for common Web3 UI patterns:
125
+
126
+ ```tsx
127
+ import { useCopyToClipboard } from '@tuwaio/nova-core';
128
+
129
+ function WalletAddress({ address }: { address: string }) {
130
+ const [copied, copy] = useCopyToClipboard();
131
+
132
+ return (
133
+ <div className={cn('transition-all', isCollapsed && 'w-12')}>
134
+ <button
135
+ onClick={() => copy(address)}
136
+ className="font-mono text-sm hover:bg-[var(--tuwa-bg-hover)]"
137
+ >
138
+ {address.slice(0, 6)}
139
+ {copied && ' ✓'}
140
+ </button>
141
+ </div>
142
+ );
143
+ }
144
+ ```
145
+
146
+ -----
147
+
148
+ ## 🛠️ Theme Customization
149
+
150
+ ### Basic Customization
151
+
152
+ Override design tokens in your CSS to match your brand:
153
+
154
+ ```css
155
+ /* src/styles/globals.css */
156
+ @import '@tuwaio/nova-core/dist/index.css';
157
+
158
+ /* Your custom theme overrides */
159
+ :root {
160
+ /* Brand Colors */
161
+ --tuwa-color-primary: #3b82f6; /* Blue-500 */
162
+ --tuwa-color-primary-hover: #2563eb; /* Blue-600 */
163
+
164
+ /* Background System */
165
+ --tuwa-bg-primary: #ffffff;
166
+ --tuwa-bg-secondary: #f8fafc;
167
+ --tuwa-bg-hover: #f1f5f9;
168
+
169
+ /* Text Colors */
170
+ --tuwa-text-primary: #0f172a;
171
+ --tuwa-text-secondary: #64748b;
172
+ --tuwa-text-muted: #94a3b8;
173
+
174
+ /* Border System */
175
+ --tuwa-border-primary: #e2e8f0;
176
+ --tuwa-border-secondary: #cbd5e1;
177
+ }
178
+ ```
179
+
180
+ ### Dark Mode Support
181
+
182
+ Nova Core includes built-in dark mode support:
183
+
184
+ ```css
185
+ /* Dark mode overrides */
186
+ .dark {
187
+ --tuwa-color-primary: #60a5fa; /* Blue-400 */
188
+ --tuwa-bg-primary: #0f172a; /* Slate-900 */
189
+ --tuwa-bg-secondary: #1e293b; /* Slate-800 */
190
+ --tuwa-text-primary: #f1f5f9; /* Slate-100 */
191
+ --tuwa-text-secondary: #cbd5e1; /* Slate-300 */
192
+ --tuwa-border-primary: #374151; /* Gray-700 */
193
+ }
194
+ ```
195
+
196
+ ### Advanced Usage
197
+
198
+ #### Component Integration
199
+
200
+ Nova Core works seamlessly with other Nova packages:
201
+
202
+ ```tsx
203
+ import { cn } from '@tuwaio/nova-core';
204
+ import { ConnectButton } from '@tuwaio/nova-connect/components';
205
+ import { NovaTransactionsProvider } from '@tuwaio/nova-transactions';
206
+
207
+ function App() {
208
+ return (
209
+ <div className={cn(
210
+ 'min-h-screen',
211
+ 'bg-[var(--tuwa-bg-primary)]',
212
+ 'text-[var(--tuwa-text-primary)]'
213
+ )}>
214
+ <NovaTransactionsProvider {...params} />
215
+ <header className="border-b border-[var(--tuwa-border-primary)]">
216
+ <ConnectButton />
217
+ </header>
218
+ <main>
219
+ {/* Your app content */}
220
+ </main>
221
+ </div>
222
+ );
223
+ }
224
+ ```
225
+
226
+ ### API Reference
227
+
228
+ #### Utilities
229
+
230
+ | Function | Description | Usage |
231
+ | :--- | :--- | :--- |
232
+ | **`cn(...classes)`** | Merges class names intelligently, resolving Tailwind conflicts | `cn('p-4 text-sm', 'p-6', conditional && 'hidden')` |
233
+
234
+ #### Hooks
235
+
236
+ | Hook | Description | Return Type |
237
+ | :--- | :--- | :--- |
238
+ | **`useCopyToClipboard()`** | Copy text to clipboard with feedback | `[boolean, (text: string) => void]` |
239
+ | **`useMediaQuery(query)`** | Responsive media query hook | `boolean` |
240
+
49
241
  ## 🤝 Contributing & Support
50
242
 
51
243
  Contributions are welcome! Please read our main **[Contribution Guidelines](https://github.com/TuwaIO/workflows/blob/main/CONTRIBUTING.md)**.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuwaio/nova-core",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "private": false,
5
5
  "author": "Oleksandr Tkach",
6
6
  "license": "Apache-2.0",