@asafarim/react-themes 1.1.0 โ 1.2.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/README.md +416 -49
- package/dist/react-themes-dark.png +0 -0
- package/dist/react-themes-light.png +0 -0
- package/package.json +9 -4
- package/src/react-themes-dark.png +0 -0
- package/src/react-themes-light.png +0 -0
package/README.md
CHANGED
|
@@ -6,16 +6,85 @@ A comprehensive theme management system for React applications with automatic da
|
|
|
6
6
|

|
|
7
7
|

|
|
8
8
|
|
|
9
|
+
## ๐ธ Preview
|
|
10
|
+
|
|
11
|
+
Experience the theme system in action with our **[Live Interactive Demo](https://bibliography.asafarim.com/react-themes/demo)**
|
|
12
|
+
|
|
13
|
+
### ๐ฏ Demo Showcases
|
|
14
|
+
|
|
15
|
+
The live demo demonstrates all package capabilities:
|
|
16
|
+
|
|
17
|
+
- **๐จ Theme Switching**: Real-time theme transitions between light, dark, and auto modes
|
|
18
|
+
- **๐ง Component Gallery**: All built-in components (ThemeToggle, ThemeSelector) in action
|
|
19
|
+
- **๐ฑ Responsive Design**: How themes adapt across different screen sizes
|
|
20
|
+
- **๐ช CSS Variables**: Live CSS variable updates and their effects
|
|
21
|
+
- **โก Performance**: Smooth animations and transitions
|
|
22
|
+
- **โฟ Accessibility**: Keyboard navigation and screen reader support
|
|
23
|
+
|
|
24
|
+
<table>
|
|
25
|
+
<tr>
|
|
26
|
+
<td align="center">
|
|
27
|
+
<img src="./src/react-themes-light.png" alt="Light Theme Preview" width="400"/>
|
|
28
|
+
<br/>
|
|
29
|
+
<em>Light Theme - Clean and Modern</em>
|
|
30
|
+
</td>
|
|
31
|
+
<td align="center">
|
|
32
|
+
<img src="./src/react-themes-dark.png" alt="Dark Theme Preview" width="400"/>
|
|
33
|
+
<br/>
|
|
34
|
+
<em>Dark Theme - Elegant and Eye-friendly</em>
|
|
35
|
+
</td>
|
|
36
|
+
</tr>
|
|
37
|
+
</table>
|
|
38
|
+
|
|
39
|
+
### ๐ Try It Live
|
|
40
|
+
|
|
41
|
+
Visit **[bibliography.asafarim.com/react-themes/demo](https://bibliography.asafarim.com/react-themes/demo)** to:
|
|
42
|
+
|
|
43
|
+
1. **Interactive Testing**: Toggle between themes and see instant changes
|
|
44
|
+
2. **Code Examples**: View implementation examples for each feature
|
|
45
|
+
3. **Performance Metrics**: See how fast theme switching works
|
|
46
|
+
4. **Integration Examples**: Real-world usage with other components
|
|
47
|
+
5. **Customization Demo**: Examples of custom theme creation
|
|
48
|
+
6. **Browser Compatibility**: Test across different browsers and devices
|
|
49
|
+
|
|
9
50
|
## โจ Features
|
|
10
51
|
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
52
|
+
### ๐ **Smart Theme Management**
|
|
53
|
+
- **Auto Detection**: Automatically detects and follows system dark/light mode preferences
|
|
54
|
+
- **Manual Override**: Users can manually select their preferred theme mode
|
|
55
|
+
- **Persistence**: Remembers user choice across browser sessions using localStorage
|
|
56
|
+
- **Real-time Updates**: Instantly responds to system theme changes
|
|
57
|
+
|
|
58
|
+
### ๐จ **Advanced Theming System**
|
|
59
|
+
- **Built-in Themes**: Professionally designed light and dark themes out of the box
|
|
60
|
+
- **Custom Themes**: Create unlimited custom themes with full control over colors, spacing, and typography
|
|
61
|
+
- **Theme Merging**: Easily extend existing themes with custom properties
|
|
62
|
+
- **CSS Variables**: Automatic injection of CSS custom properties for seamless styling
|
|
63
|
+
|
|
64
|
+
### โก **Performance & User Experience**
|
|
65
|
+
- **Smooth Transitions**: Beautiful, configurable transitions between theme changes
|
|
66
|
+
- **Zero Flicker**: Prevents flash of unstyled content during theme initialization
|
|
67
|
+
- **Lightweight**: Minimal bundle size impact (~8KB gzipped)
|
|
68
|
+
- **Tree Shakeable**: Import only what you need
|
|
69
|
+
|
|
70
|
+
### ๐ง **Developer Experience**
|
|
71
|
+
- **TypeScript First**: Full TypeScript support with comprehensive type definitions
|
|
72
|
+
- **React 18+ Ready**: Optimized for latest React features including concurrent rendering
|
|
73
|
+
- **Hooks API**: Intuitive React hooks for theme management
|
|
74
|
+
- **Component Library**: Pre-built, accessible components for common use cases
|
|
75
|
+
|
|
76
|
+
### ๐ฏ **Integration & Compatibility**
|
|
77
|
+
- **Framework Agnostic**: Works with any React-based framework (Next.js, Gatsby, CRA, Vite)
|
|
78
|
+
- **CSS-in-JS Compatible**: Works with styled-components, emotion, and other CSS-in-JS libraries
|
|
79
|
+
- **Tailwind Ready**: Seamlessly integrates with Tailwind CSS through CSS variables
|
|
80
|
+
- **Server-Side Rendering**: Full SSR support with proper hydration handling
|
|
81
|
+
|
|
82
|
+
### โฟ **Accessibility & Standards**
|
|
83
|
+
- **WCAG Compliant**: Meets Web Content Accessibility Guidelines
|
|
84
|
+
- **Keyboard Navigation**: Full keyboard support for all interactive elements
|
|
85
|
+
- **Screen Reader Support**: Proper ARIA labels and announcements
|
|
86
|
+
- **High Contrast**: Ensures sufficient color contrast ratios in all themes
|
|
87
|
+
- **Reduced Motion**: Respects user's motion preferences
|
|
19
88
|
|
|
20
89
|
## ๐ฆ Installation
|
|
21
90
|
|
|
@@ -64,11 +133,117 @@ function MyComponent() {
|
|
|
64
133
|
}
|
|
65
134
|
```
|
|
66
135
|
|
|
136
|
+
## ๐ฏ Use Cases & Examples
|
|
137
|
+
|
|
138
|
+
### ๐ **Real-World Applications**
|
|
139
|
+
|
|
140
|
+
Our **[Live Demo](https://bibliography.asafarim.com/react-themes/demo)** showcases these practical implementations:
|
|
141
|
+
|
|
142
|
+
#### ๐ **Web Applications**
|
|
143
|
+
```tsx
|
|
144
|
+
// E-commerce dashboard with theme switching
|
|
145
|
+
import { ThemeProvider, ThemeToggle } from '@asafarim/react-themes';
|
|
146
|
+
|
|
147
|
+
function EcommerceDashboard() {
|
|
148
|
+
return (
|
|
149
|
+
<ThemeProvider defaultMode="auto" persistMode={true}>
|
|
150
|
+
<header className="dashboard-header">
|
|
151
|
+
<h1>Sales Dashboard</h1>
|
|
152
|
+
<ThemeToggle size="sm" showLabels={true} />
|
|
153
|
+
</header>
|
|
154
|
+
<main className="dashboard-content">
|
|
155
|
+
{/* Dashboard content adapts automatically */}
|
|
156
|
+
</main>
|
|
157
|
+
</ThemeProvider>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### ๐ฑ **Mobile-First Design**
|
|
163
|
+
```css
|
|
164
|
+
/* Responsive design that adapts to theme */
|
|
165
|
+
.mobile-card {
|
|
166
|
+
background: var(--theme-color-background-secondary);
|
|
167
|
+
border: 1px solid var(--theme-color-border);
|
|
168
|
+
padding: var(--theme-spacing-md);
|
|
169
|
+
border-radius: var(--theme-radius-lg);
|
|
170
|
+
|
|
171
|
+
/* Automatic dark mode styling */
|
|
172
|
+
box-shadow: var(--theme-shadow-sm);
|
|
173
|
+
transition: var(--theme-transition-normal);
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### ๐จ **Design Systems**
|
|
178
|
+
```tsx
|
|
179
|
+
// Integration with component libraries
|
|
180
|
+
import { Button, Card } from 'your-ui-library';
|
|
181
|
+
import { useTheme } from '@asafarim/react-themes';
|
|
182
|
+
|
|
183
|
+
function ThemedComponents() {
|
|
184
|
+
const { currentTheme } = useTheme();
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<Card
|
|
188
|
+
style={{
|
|
189
|
+
backgroundColor: currentTheme.colors.background,
|
|
190
|
+
color: currentTheme.colors.text
|
|
191
|
+
}}
|
|
192
|
+
>
|
|
193
|
+
<Button variant={currentTheme.mode === 'dark' ? 'outlined' : 'filled'}>
|
|
194
|
+
Themed Button
|
|
195
|
+
</Button>
|
|
196
|
+
</Card>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### ๐ **Advanced Patterns**
|
|
202
|
+
|
|
203
|
+
#### ๐ช **Dynamic Theme Loading**
|
|
204
|
+
```tsx
|
|
205
|
+
// Load themes dynamically based on user preferences
|
|
206
|
+
import { createTheme, useTheme } from '@asafarim/react-themes';
|
|
207
|
+
|
|
208
|
+
function DynamicThemeLoader() {
|
|
209
|
+
const { setTheme } = useTheme();
|
|
210
|
+
|
|
211
|
+
const loadUserTheme = async (userId: string) => {
|
|
212
|
+
const userPrefs = await fetch(`/api/users/${userId}/theme`);
|
|
213
|
+
const themeData = await userPrefs.json();
|
|
214
|
+
|
|
215
|
+
const customTheme = createTheme(themeData);
|
|
216
|
+
setTheme(customTheme);
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
return <div>Loading personalized theme...</div>;
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
#### ๐ข **Multi-Brand Applications**
|
|
224
|
+
```tsx
|
|
225
|
+
// Switch between different brand themes
|
|
226
|
+
const brandThemes = {
|
|
227
|
+
corporate: createTheme(lightTheme, {
|
|
228
|
+
name: 'corporate',
|
|
229
|
+
colors: { primary: '#0066cc', secondary: '#004499' }
|
|
230
|
+
}),
|
|
231
|
+
creative: createTheme(darkTheme, {
|
|
232
|
+
name: 'creative',
|
|
233
|
+
colors: { primary: '#ff6b6b', secondary: '#4ecdc4' }
|
|
234
|
+
})
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
<ThemeProvider customThemes={brandThemes}>
|
|
238
|
+
<BrandSwitcher />
|
|
239
|
+
</ThemeProvider>
|
|
240
|
+
```
|
|
241
|
+
|
|
67
242
|
## ๐ API Reference
|
|
68
243
|
|
|
69
|
-
### ThemeProvider
|
|
244
|
+
### ๐๏ธ ThemeProvider
|
|
70
245
|
|
|
71
|
-
The
|
|
246
|
+
The foundational component that manages theme state and applies CSS variables throughout your application.
|
|
72
247
|
|
|
73
248
|
```tsx
|
|
74
249
|
interface ThemeProviderProps {
|
|
@@ -78,44 +253,116 @@ interface ThemeProviderProps {
|
|
|
78
253
|
persistMode?: boolean;
|
|
79
254
|
storageKey?: string;
|
|
80
255
|
customThemes?: Record<string, Theme>;
|
|
256
|
+
config?: ThemeConfig;
|
|
81
257
|
}
|
|
82
258
|
```
|
|
83
259
|
|
|
84
|
-
**Props:**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
260
|
+
**Essential Props:**
|
|
261
|
+
|
|
262
|
+
| Prop | Type | Default | Description |
|
|
263
|
+
|------|------|---------|-------------|
|
|
264
|
+
| `children` | `ReactNode` | **required** | Child components to provide theme context to |
|
|
265
|
+
| `defaultMode` | `'light' \| 'dark' \| 'auto'` | `'auto'` | Initial theme mode on first load |
|
|
266
|
+
| `defaultTheme` | `string` | `'default'` | Name of the default theme to use |
|
|
267
|
+
| `persistMode` | `boolean` | `true` | Whether to save user's theme choice to localStorage |
|
|
268
|
+
| `storageKey` | `string` | `'asafarim-theme-mode'` | localStorage key for persistence |
|
|
269
|
+
| `customThemes` | `Record<string, Theme>` | `{}` | Additional themes to make available |
|
|
90
270
|
|
|
91
|
-
|
|
271
|
+
**Advanced Configuration:**
|
|
272
|
+
```tsx
|
|
273
|
+
// Extended configuration options
|
|
274
|
+
interface ThemeConfig {
|
|
275
|
+
transitionDuration?: string;
|
|
276
|
+
breakpoints?: Record<string, string>;
|
|
277
|
+
enableSystemTheme?: boolean;
|
|
278
|
+
cssVariablePrefix?: string;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
<ThemeProvider
|
|
282
|
+
config={{
|
|
283
|
+
transitionDuration: '200ms',
|
|
284
|
+
enableSystemTheme: true,
|
|
285
|
+
cssVariablePrefix: 'app-theme'
|
|
286
|
+
}}
|
|
287
|
+
>
|
|
288
|
+
<App />
|
|
289
|
+
</ThemeProvider>
|
|
290
|
+
```
|
|
92
291
|
|
|
93
|
-
|
|
292
|
+
### ๐ช useTheme Hook
|
|
94
293
|
|
|
294
|
+
The primary hook for accessing and controlling theme state.
|
|
295
|
+
|
|
296
|
+
```tsx
|
|
297
|
+
interface UseThemeReturn {
|
|
298
|
+
currentTheme: Theme; // Currently active theme object
|
|
299
|
+
mode: ThemeMode; // Current mode: 'light' | 'dark' | 'auto'
|
|
300
|
+
setMode: (mode: ThemeMode) => void; // Change theme mode
|
|
301
|
+
setTheme: (theme: Theme) => void; // Change active theme
|
|
302
|
+
themes: Record<string, Theme>; // All available themes
|
|
303
|
+
toggleMode: () => void; // Cycle through light โ dark โ auto
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
**Real-world Example:**
|
|
95
308
|
```tsx
|
|
96
|
-
|
|
97
|
-
currentTheme,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
309
|
+
function ThemeAwareComponent() {
|
|
310
|
+
const { currentTheme, mode, setMode, toggleMode } = useTheme();
|
|
311
|
+
|
|
312
|
+
// Conditional styling based on theme
|
|
313
|
+
const isDarkMode = mode === 'dark' ||
|
|
314
|
+
(mode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
|
315
|
+
|
|
316
|
+
return (
|
|
317
|
+
<div style={{
|
|
318
|
+
backgroundColor: currentTheme.colors.background,
|
|
319
|
+
color: currentTheme.colors.text
|
|
320
|
+
}}>
|
|
321
|
+
<h2>Current Theme: {currentTheme.name}</h2>
|
|
322
|
+
<p>Mode: {mode} {isDarkMode ? '๐' : 'โ๏ธ'}</p>
|
|
323
|
+
<button onClick={toggleMode}>Toggle Theme</button>
|
|
324
|
+
</div>
|
|
325
|
+
);
|
|
326
|
+
}
|
|
104
327
|
```
|
|
105
328
|
|
|
106
|
-
### useThemeToggle Hook
|
|
329
|
+
### โก useThemeToggle Hook
|
|
330
|
+
|
|
331
|
+
Simplified hook specifically for theme mode toggling with additional utilities.
|
|
107
332
|
|
|
108
|
-
|
|
333
|
+
```tsx
|
|
334
|
+
interface UseThemeToggleReturn {
|
|
335
|
+
mode: ThemeMode; // Current theme mode
|
|
336
|
+
setMode: (mode: ThemeMode) => void; // Set specific mode
|
|
337
|
+
toggleMode: () => void; // Cycle through modes
|
|
338
|
+
isDark: boolean; // true if dark mode is active
|
|
339
|
+
isLight: boolean; // true if light mode is active
|
|
340
|
+
isAuto: boolean; // true if auto mode is active
|
|
341
|
+
effectiveMode: 'light' | 'dark'; // Resolved mode (auto becomes light/dark)
|
|
342
|
+
}
|
|
343
|
+
```
|
|
109
344
|
|
|
345
|
+
**Practical Usage:**
|
|
110
346
|
```tsx
|
|
111
|
-
|
|
112
|
-
mode,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
347
|
+
function SmartThemeButton() {
|
|
348
|
+
const { mode, toggleMode, isDark, effectiveMode } = useThemeToggle();
|
|
349
|
+
|
|
350
|
+
const getIcon = () => {
|
|
351
|
+
if (mode === 'auto') return '๐';
|
|
352
|
+
return isDark ? '๐' : 'โ๏ธ';
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
const getLabel = () => {
|
|
356
|
+
if (mode === 'auto') return `Auto (${effectiveMode})`;
|
|
357
|
+
return mode === 'dark' ? 'Dark Mode' : 'Light Mode';
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
return (
|
|
361
|
+
<button onClick={toggleMode} title={getLabel()}>
|
|
362
|
+
{getIcon()} {getLabel()}
|
|
363
|
+
</button>
|
|
364
|
+
);
|
|
365
|
+
}
|
|
119
366
|
```
|
|
120
367
|
|
|
121
368
|
### Components
|
|
@@ -218,6 +465,54 @@ function NavMenu() {
|
|
|
218
465
|
}
|
|
219
466
|
```
|
|
220
467
|
|
|
468
|
+
## ๐ Live Demo & Showcase
|
|
469
|
+
|
|
470
|
+
### ๐ญ **Interactive Demo**
|
|
471
|
+
|
|
472
|
+
Experience all features at **[bibliography.asafarim.com/react-themes/demo](https://bibliography.asafarim.com/react-themes/demo)**
|
|
473
|
+
|
|
474
|
+
The demo is a comprehensive showcase featuring:
|
|
475
|
+
|
|
476
|
+
#### ๐จ **Theme Gallery**
|
|
477
|
+
- **Light Theme**: Clean, modern interface with excellent readability
|
|
478
|
+
- **Dark Theme**: Elegant dark mode optimized for low-light environments
|
|
479
|
+
- **Auto Mode**: Intelligent system preference detection with seamless switching
|
|
480
|
+
- **Custom Themes**: Examples of brand-specific and specialized themes
|
|
481
|
+
|
|
482
|
+
#### ๐ ๏ธ **Component Showcase**
|
|
483
|
+
- **ThemeToggle Variants**: Different sizes, styles, and label configurations
|
|
484
|
+
- **ThemeSelector**: Dropdown with icons, labels, and custom options
|
|
485
|
+
- **Integration Examples**: Real components using theme variables
|
|
486
|
+
- **Performance Metrics**: Live transition timing and smoothness demos
|
|
487
|
+
|
|
488
|
+
#### ๐ **Technical Demonstrations**
|
|
489
|
+
- **CSS Variables Live**: Watch variables update in real-time as themes change
|
|
490
|
+
- **Browser Compatibility**: Cross-browser testing interface
|
|
491
|
+
- **Accessibility Features**: Screen reader announcements and keyboard navigation
|
|
492
|
+
- **Mobile Responsiveness**: Touch-optimized controls and layouts
|
|
493
|
+
|
|
494
|
+
#### ๐ง **Developer Tools**
|
|
495
|
+
- **Code Examples**: Copy-paste ready implementations
|
|
496
|
+
- **Theme Inspector**: Live theme object visualization
|
|
497
|
+
- **CSS Variable Explorer**: All available variables with current values
|
|
498
|
+
- **Performance Monitor**: Bundle size and render time metrics
|
|
499
|
+
|
|
500
|
+
### ๐ฑ **Mobile-Optimized Experience**
|
|
501
|
+
|
|
502
|
+
The demo is fully responsive and showcases:
|
|
503
|
+
- Touch-friendly theme controls
|
|
504
|
+
- Swipe gestures for theme switching
|
|
505
|
+
- Adaptive layouts for different screen sizes
|
|
506
|
+
- Battery-conscious animations
|
|
507
|
+
|
|
508
|
+
### ๐ฏ **Use Cases Demonstrated**
|
|
509
|
+
|
|
510
|
+
1. **E-commerce Interface**: Product cards, navigation, and checkout flows
|
|
511
|
+
2. **Dashboard Layout**: Charts, tables, and control panels
|
|
512
|
+
3. **Content Management**: Text editors, media galleries, and forms
|
|
513
|
+
4. **Social Platform**: Posts, comments, and user profiles
|
|
514
|
+
5. **Documentation Site**: Code blocks, navigation, and search interfaces
|
|
515
|
+
|
|
221
516
|
## ๐ง Advanced Usage
|
|
222
517
|
|
|
223
518
|
### Custom Theme Structure
|
|
@@ -266,26 +561,98 @@ applyTheme(customTheme, 'dark');
|
|
|
266
561
|
|
|
267
562
|
## ๐ค Contributing
|
|
268
563
|
|
|
269
|
-
|
|
564
|
+
We welcome contributions! The project is open source and actively maintained.
|
|
270
565
|
|
|
271
|
-
|
|
566
|
+
### ๐ ๏ธ **Development Setup**
|
|
567
|
+
```bash
|
|
568
|
+
git clone https://github.com/AliSafari-IT/asafarim
|
|
569
|
+
cd ASafariM.Clients/packages/react-themes
|
|
570
|
+
pnpm install
|
|
571
|
+
pnpm build
|
|
572
|
+
pnpm test
|
|
573
|
+
```
|
|
272
574
|
|
|
273
|
-
|
|
575
|
+
### ๐งช **Testing the Demo**
|
|
576
|
+
```bash
|
|
577
|
+
# Run the demo locally
|
|
578
|
+
cd ../../asafarim-bibliography
|
|
579
|
+
pnpm install
|
|
580
|
+
pnpm start
|
|
581
|
+
# Visit http://localhost:3004/react-themes/demo
|
|
582
|
+
```
|
|
274
583
|
|
|
275
|
-
|
|
584
|
+
### ๐ **Contribution Guidelines**
|
|
585
|
+
- Follow TypeScript best practices
|
|
586
|
+
- Add tests for new features
|
|
587
|
+
- Update documentation and examples
|
|
588
|
+
- Ensure accessibility compliance
|
|
589
|
+
- Test across different browsers
|
|
276
590
|
|
|
277
|
-
|
|
591
|
+
## ๐ License
|
|
278
592
|
|
|
279
|
-
|
|
593
|
+
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
280
594
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
-
|
|
595
|
+
## ๐ **Why Choose @asafarim/react-themes?**
|
|
596
|
+
|
|
597
|
+
### โ
**Production Ready**
|
|
598
|
+
- Used in production at [ASafariM Bibliography](https://bibliography.asafarim.com)
|
|
599
|
+
- Thoroughly tested across browsers and devices
|
|
600
|
+
- Optimized for performance and accessibility
|
|
601
|
+
- Regular updates and maintenance
|
|
602
|
+
|
|
603
|
+
### ๐ฏ **Developer Focused**
|
|
604
|
+
- Extensive TypeScript support
|
|
605
|
+
- Comprehensive documentation with live examples
|
|
606
|
+
- Active community support
|
|
607
|
+
- Regular feature updates based on user feedback
|
|
608
|
+
|
|
609
|
+
### ๐ **Modern Standards**
|
|
610
|
+
- React 18+ optimized
|
|
611
|
+
- CSS3 custom properties
|
|
612
|
+
- ES2020+ JavaScript features
|
|
613
|
+
- Modern bundling and tree-shaking support
|
|
614
|
+
|
|
615
|
+
## ๐ Related Packages & Ecosystem
|
|
616
|
+
|
|
617
|
+
- **[`@asafarim/dd-menu`](https://www.npmjs.com/package/@asafarim/dd-menu)** - Elegant dropdown menu component with theme integration
|
|
618
|
+
- **[ASafariM Bibliography](https://bibliography.asafarim.com)** - Live application showcasing the theme system
|
|
619
|
+
- **[Interactive Demo](https://bibliography.asafarim.com/react-themes/demo)** - Comprehensive feature demonstration
|
|
620
|
+
|
|
621
|
+
## ๏ฟฝ Project Stats
|
|
622
|
+
|
|
623
|
+
- ๐๏ธ **Built with**: TypeScript, React 18, CSS3 Custom Properties
|
|
624
|
+
- ๐ฆ **Bundle Size**: ~8KB gzipped
|
|
625
|
+
- ๐ **Browser Support**: Modern browsers (Chrome 49+, Firefox 31+, Safari 9.1+, Edge 16+)
|
|
626
|
+
- โก **Performance**: Zero-flicker theme switching, optimized re-renders
|
|
627
|
+
- โฟ **Accessibility**: WCAG 2.1 AA compliant
|
|
628
|
+
|
|
629
|
+
## ๏ฟฝ๐ Changelog
|
|
630
|
+
|
|
631
|
+
### ๐ **v1.1.0** - Latest
|
|
632
|
+
- Enhanced TypeScript definitions
|
|
633
|
+
- Improved performance and bundle size
|
|
634
|
+
- Added comprehensive demo showcase
|
|
635
|
+
- Extended browser compatibility
|
|
636
|
+
- New theme customization options
|
|
637
|
+
|
|
638
|
+
### ๐ **v1.0.0** - Initial Release
|
|
639
|
+
- Core theme provider functionality
|
|
640
|
+
- Auto mode detection with system preference sync
|
|
641
|
+
- CSS variable injection system
|
|
285
642
|
- Built-in components (ThemeToggle, ThemeSelector)
|
|
286
|
-
- TypeScript support
|
|
287
|
-
- localStorage persistence
|
|
643
|
+
- TypeScript support with full type safety
|
|
644
|
+
- localStorage persistence with customizable keys
|
|
288
645
|
|
|
289
646
|
---
|
|
290
647
|
|
|
291
|
-
|
|
648
|
+
<div align="center">
|
|
649
|
+
|
|
650
|
+
### ๐ **Experience the Future of React Theming**
|
|
651
|
+
|
|
652
|
+
**[Try the Live Demo](https://bibliography.asafarim.com/react-themes/demo)** | **[View Documentation](https://www.npmjs.com/package/@asafarim/react-themes)** | **[See Source Code](https://github.com/AliSafari-IT/asafarim)**
|
|
653
|
+
|
|
654
|
+
Made with โค๏ธ and โ by **[ASafariM](https://github.com/AliSafari-IT)**
|
|
655
|
+
|
|
656
|
+
*Empowering developers to create beautiful, accessible, and user-friendly themed applications*
|
|
657
|
+
|
|
658
|
+
</div>
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asafarim/react-themes",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A comprehensive theme management system for React applications with automatic dark/light mode detection, custom theme creation, and smooth transitions.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -15,10 +15,15 @@
|
|
|
15
15
|
"require": "./dist/index.js"
|
|
16
16
|
},
|
|
17
17
|
"./styles.css": "./dist/styles.css",
|
|
18
|
-
"./src/styles.css": "./src/styles.css"
|
|
18
|
+
"./src/styles.css": "./src/styles.css",
|
|
19
|
+
"./src/react-themes-dark.png": "./src/react-themes-dark.png",
|
|
20
|
+
"./react-themes-dark.png": "./dist/react-themes-dark.png",
|
|
21
|
+
"./src/react-themes-light.png": "./src/react-themes-light.png"
|
|
19
22
|
},
|
|
20
23
|
"files": [
|
|
21
24
|
"dist",
|
|
25
|
+
"src/react-themes-light.png",
|
|
26
|
+
"src/react-themes-dark.png",
|
|
22
27
|
"README.md",
|
|
23
28
|
"LICENSE"
|
|
24
29
|
],
|
|
@@ -78,8 +83,8 @@
|
|
|
78
83
|
]
|
|
79
84
|
},
|
|
80
85
|
"scripts": {
|
|
81
|
-
"build": "tsup && npm run copy-
|
|
82
|
-
"copy-
|
|
86
|
+
"build": "tsup && npm run copy-assets",
|
|
87
|
+
"copy-assets": "node -e \"const fs = require('fs'); fs.copyFileSync('src/styles.css', 'dist/styles.css'); fs.copyFileSync('src/react-themes-light.png', 'dist/react-themes-light.png'); fs.copyFileSync('src/react-themes-dark.png', 'dist/react-themes-dark.png');\"",
|
|
83
88
|
"dev": "tsup --watch",
|
|
84
89
|
"type-check": "tsc --noEmit",
|
|
85
90
|
"lint": "eslint src --ext .ts,.tsx",
|
|
Binary file
|
|
Binary file
|