@asafarim/react-themes 1.5.0 โ 1.6.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 +28 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -50,36 +50,42 @@ Visit **[bibliography.asafarim.com/react-themes/demo](https://bibliography.asafa
|
|
|
50
50
|
## โจ Features
|
|
51
51
|
|
|
52
52
|
### ๐ **Smart Theme Management**
|
|
53
|
+
|
|
53
54
|
- **Auto Detection**: Automatically detects and follows system dark/light mode preferences
|
|
54
55
|
- **Manual Override**: Users can manually select their preferred theme mode
|
|
55
56
|
- **Persistence**: Remembers user choice across browser sessions using localStorage
|
|
56
57
|
- **Real-time Updates**: Instantly responds to system theme changes
|
|
57
58
|
|
|
58
59
|
### ๐จ **Advanced Theming System**
|
|
60
|
+
|
|
59
61
|
- **Built-in Themes**: Professionally designed light and dark themes out of the box
|
|
60
62
|
- **Custom Themes**: Create unlimited custom themes with full control over colors, spacing, and typography
|
|
61
63
|
- **Theme Merging**: Easily extend existing themes with custom properties
|
|
62
64
|
- **CSS Variables**: Automatic injection of CSS custom properties for seamless styling
|
|
63
65
|
|
|
64
66
|
### โก **Performance & User Experience**
|
|
67
|
+
|
|
65
68
|
- **Smooth Transitions**: Beautiful, configurable transitions between theme changes
|
|
66
69
|
- **Zero Flicker**: Prevents flash of unstyled content during theme initialization
|
|
67
70
|
- **Lightweight**: Minimal bundle size impact (~8KB gzipped)
|
|
68
71
|
- **Tree Shakeable**: Import only what you need
|
|
69
72
|
|
|
70
73
|
### ๐ง **Developer Experience**
|
|
74
|
+
|
|
71
75
|
- **TypeScript First**: Full TypeScript support with comprehensive type definitions
|
|
72
76
|
- **React 18+ Ready**: Optimized for latest React features including concurrent rendering
|
|
73
77
|
- **Hooks API**: Intuitive React hooks for theme management
|
|
74
78
|
- **Component Library**: Pre-built, accessible components for common use cases
|
|
75
79
|
|
|
76
80
|
### ๐ฏ **Integration & Compatibility**
|
|
81
|
+
|
|
77
82
|
- **Framework Agnostic**: Works with any React-based framework (Next.js, Gatsby, CRA, Vite)
|
|
78
83
|
- **CSS-in-JS Compatible**: Works with styled-components, emotion, and other CSS-in-JS libraries
|
|
79
84
|
- **Tailwind Ready**: Seamlessly integrates with Tailwind CSS through CSS variables
|
|
80
85
|
- **Server-Side Rendering**: Full SSR support with proper hydration handling
|
|
81
86
|
|
|
82
87
|
### โฟ **Accessibility & Standards**
|
|
88
|
+
|
|
83
89
|
- **WCAG Compliant**: Meets Web Content Accessibility Guidelines
|
|
84
90
|
- **Keyboard Navigation**: Full keyboard support for all interactive elements
|
|
85
91
|
- **Screen Reader Support**: Proper ARIA labels and announcements
|
|
@@ -140,6 +146,7 @@ function MyComponent() {
|
|
|
140
146
|
Our **[Live Demo](https://bibliography.asafarim.com/react-themes/demo)** showcases these practical implementations:
|
|
141
147
|
|
|
142
148
|
#### ๐ **Web Applications**
|
|
149
|
+
|
|
143
150
|
```tsx
|
|
144
151
|
// E-commerce dashboard with theme switching
|
|
145
152
|
import { ThemeProvider, ThemeToggle } from '@asafarim/react-themes';
|
|
@@ -160,6 +167,7 @@ function EcommerceDashboard() {
|
|
|
160
167
|
```
|
|
161
168
|
|
|
162
169
|
#### ๐ฑ **Mobile-First Design**
|
|
170
|
+
|
|
163
171
|
```css
|
|
164
172
|
/* Responsive design that adapts to theme */
|
|
165
173
|
.mobile-card {
|
|
@@ -175,6 +183,7 @@ function EcommerceDashboard() {
|
|
|
175
183
|
```
|
|
176
184
|
|
|
177
185
|
#### ๐จ **Design Systems**
|
|
186
|
+
|
|
178
187
|
```tsx
|
|
179
188
|
// Integration with component libraries
|
|
180
189
|
import { Button, Card } from 'your-ui-library';
|
|
@@ -201,6 +210,7 @@ function ThemedComponents() {
|
|
|
201
210
|
### ๐ **Advanced Patterns**
|
|
202
211
|
|
|
203
212
|
#### ๐ช **Dynamic Theme Loading**
|
|
213
|
+
|
|
204
214
|
```tsx
|
|
205
215
|
// Load themes dynamically based on user preferences
|
|
206
216
|
import { createTheme, useTheme } from '@asafarim/react-themes';
|
|
@@ -221,6 +231,7 @@ function DynamicThemeLoader() {
|
|
|
221
231
|
```
|
|
222
232
|
|
|
223
233
|
#### ๐ข **Multi-Brand Applications**
|
|
234
|
+
|
|
224
235
|
```tsx
|
|
225
236
|
// Switch between different brand themes
|
|
226
237
|
const brandThemes = {
|
|
@@ -269,6 +280,7 @@ interface ThemeProviderProps {
|
|
|
269
280
|
| `customThemes` | `Record<string, Theme>` | `{}` | Additional themes to make available |
|
|
270
281
|
|
|
271
282
|
**Advanced Configuration:**
|
|
283
|
+
|
|
272
284
|
```tsx
|
|
273
285
|
// Extended configuration options
|
|
274
286
|
interface ThemeConfig {
|
|
@@ -305,6 +317,7 @@ interface UseThemeReturn {
|
|
|
305
317
|
```
|
|
306
318
|
|
|
307
319
|
**Real-world Example:**
|
|
320
|
+
|
|
308
321
|
```tsx
|
|
309
322
|
function ThemeAwareComponent() {
|
|
310
323
|
const { currentTheme, mode, setMode, toggleMode } = useTheme();
|
|
@@ -343,6 +356,7 @@ interface UseThemeToggleReturn {
|
|
|
343
356
|
```
|
|
344
357
|
|
|
345
358
|
**Practical Usage:**
|
|
359
|
+
|
|
346
360
|
```tsx
|
|
347
361
|
function SmartThemeButton() {
|
|
348
362
|
const { mode, toggleMode, isDark, effectiveMode } = useThemeToggle();
|
|
@@ -474,24 +488,28 @@ Experience all features at **[bibliography.asafarim.com/react-themes/demo](https
|
|
|
474
488
|
The demo is a comprehensive showcase featuring:
|
|
475
489
|
|
|
476
490
|
#### ๐จ **Theme Gallery**
|
|
491
|
+
|
|
477
492
|
- **Light Theme**: Clean, modern interface with excellent readability
|
|
478
493
|
- **Dark Theme**: Elegant dark mode optimized for low-light environments
|
|
479
494
|
- **Auto Mode**: Intelligent system preference detection with seamless switching
|
|
480
495
|
- **Custom Themes**: Examples of brand-specific and specialized themes
|
|
481
496
|
|
|
482
497
|
#### ๐ ๏ธ **Component Showcase**
|
|
498
|
+
|
|
483
499
|
- **ThemeToggle Variants**: Different sizes, styles, and label configurations
|
|
484
500
|
- **ThemeSelector**: Dropdown with icons, labels, and custom options
|
|
485
501
|
- **Integration Examples**: Real components using theme variables
|
|
486
502
|
- **Performance Metrics**: Live transition timing and smoothness demos
|
|
487
503
|
|
|
488
504
|
#### ๐ **Technical Demonstrations**
|
|
505
|
+
|
|
489
506
|
- **CSS Variables Live**: Watch variables update in real-time as themes change
|
|
490
507
|
- **Browser Compatibility**: Cross-browser testing interface
|
|
491
508
|
- **Accessibility Features**: Screen reader announcements and keyboard navigation
|
|
492
509
|
- **Mobile Responsiveness**: Touch-optimized controls and layouts
|
|
493
510
|
|
|
494
511
|
#### ๐ง **Developer Tools**
|
|
512
|
+
|
|
495
513
|
- **Code Examples**: Copy-paste ready implementations
|
|
496
514
|
- **Theme Inspector**: Live theme object visualization
|
|
497
515
|
- **CSS Variable Explorer**: All available variables with current values
|
|
@@ -500,6 +518,7 @@ The demo is a comprehensive showcase featuring:
|
|
|
500
518
|
### ๐ฑ **Mobile-Optimized Experience**
|
|
501
519
|
|
|
502
520
|
The demo is fully responsive and showcases:
|
|
521
|
+
|
|
503
522
|
- Touch-friendly theme controls
|
|
504
523
|
- Swipe gestures for theme switching
|
|
505
524
|
- Adaptive layouts for different screen sizes
|
|
@@ -564,6 +583,7 @@ applyTheme(customTheme, 'dark');
|
|
|
564
583
|
We welcome contributions! The project is open source and actively maintained.
|
|
565
584
|
|
|
566
585
|
### ๐ ๏ธ **Development Setup**
|
|
586
|
+
|
|
567
587
|
```bash
|
|
568
588
|
git clone https://github.com/AliSafari-IT/asafarim
|
|
569
589
|
cd ASafariM.Clients/packages/react-themes
|
|
@@ -573,6 +593,7 @@ pnpm test
|
|
|
573
593
|
```
|
|
574
594
|
|
|
575
595
|
### ๐งช **Testing the Demo**
|
|
596
|
+
|
|
576
597
|
```bash
|
|
577
598
|
# Run the demo locally
|
|
578
599
|
cd ../../asafarim-bibliography
|
|
@@ -582,6 +603,7 @@ pnpm start
|
|
|
582
603
|
```
|
|
583
604
|
|
|
584
605
|
### ๐ **Contribution Guidelines**
|
|
606
|
+
|
|
585
607
|
- Follow TypeScript best practices
|
|
586
608
|
- Add tests for new features
|
|
587
609
|
- Update documentation and examples
|
|
@@ -595,18 +617,21 @@ MIT License - see the [LICENSE](LICENSE) file for details.
|
|
|
595
617
|
## ๐ **Why Choose @asafarim/react-themes?**
|
|
596
618
|
|
|
597
619
|
### โ
**Production Ready**
|
|
620
|
+
|
|
598
621
|
- Used in production at [ASafariM Bibliography](https://bibliography.asafarim.com)
|
|
599
622
|
- Thoroughly tested across browsers and devices
|
|
600
623
|
- Optimized for performance and accessibility
|
|
601
624
|
- Regular updates and maintenance
|
|
602
625
|
|
|
603
626
|
### ๐ฏ **Developer Focused**
|
|
627
|
+
|
|
604
628
|
- Extensive TypeScript support
|
|
605
629
|
- Comprehensive documentation with live examples
|
|
606
630
|
- Active community support
|
|
607
631
|
- Regular feature updates based on user feedback
|
|
608
632
|
|
|
609
633
|
### ๐ **Modern Standards**
|
|
634
|
+
|
|
610
635
|
- React 18+ optimized
|
|
611
636
|
- CSS3 custom properties
|
|
612
637
|
- ES2020+ JavaScript features
|
|
@@ -629,6 +654,7 @@ MIT License - see the [LICENSE](LICENSE) file for details.
|
|
|
629
654
|
## ๏ฟฝ๐ Changelog
|
|
630
655
|
|
|
631
656
|
### ๐ **v1.1.0** - Latest
|
|
657
|
+
|
|
632
658
|
- Enhanced TypeScript definitions
|
|
633
659
|
- Improved performance and bundle size
|
|
634
660
|
- Added comprehensive demo showcase
|
|
@@ -636,6 +662,7 @@ MIT License - see the [LICENSE](LICENSE) file for details.
|
|
|
636
662
|
- New theme customization options
|
|
637
663
|
|
|
638
664
|
### ๐ **v1.0.0** - Initial Release
|
|
665
|
+
|
|
639
666
|
- Core theme provider functionality
|
|
640
667
|
- Auto mode detection with system preference sync
|
|
641
668
|
- CSS variable injection system
|
|
@@ -655,4 +682,4 @@ Made with โค๏ธ and โ by **[ASafariM](https://github.com/AliSafari-IT)**
|
|
|
655
682
|
|
|
656
683
|
*Empowering developers to create beautiful, accessible, and user-friendly themed applications*
|
|
657
684
|
|
|
658
|
-
</div>
|
|
685
|
+
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asafarim/react-themes",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.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",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
],
|
|
41
41
|
"author": "Ali Safari <ali@asafarim.com>",
|
|
42
42
|
"license": "MIT",
|
|
43
|
-
"homepage": "https://github.
|
|
43
|
+
"homepage": "https://alisafari-it.github.io/react-themes/",
|
|
44
44
|
"repository": {
|
|
45
45
|
"type": "git",
|
|
46
46
|
"url": "https://github.com/AliSafari-IT/react-themes.git"
|
|
@@ -83,11 +83,14 @@
|
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|
|
85
85
|
"build": "tsup && npm run copy-assets",
|
|
86
|
+
"demo": "pnpm run build && cd demo && pnpm run dev",
|
|
86
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');\"",
|
|
87
88
|
"dev": "tsup --watch",
|
|
88
89
|
"type-check": "tsc --noEmit",
|
|
89
90
|
"lint": "eslint src --ext .ts,.tsx",
|
|
90
91
|
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
91
|
-
"clean": "rm -rf dist"
|
|
92
|
+
"clean": "rm -rf dist",
|
|
93
|
+
"predeploy": "npm run build",
|
|
94
|
+
"deploy": "gh-pages -d demo/dist"
|
|
92
95
|
}
|
|
93
96
|
}
|