solid-ui 3.0.1-4cafc12 → 3.0.1-cfddd49
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 +288 -302
- package/dist/header/index.d.ts.map +1 -1
- package/dist/header/index.js +0 -52
- package/dist/header/index.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/dist/solid-ui.esm.js +861 -1214
- package/dist/solid-ui.esm.js.map +1 -1
- package/dist/solid-ui.esm.min.js +13 -13
- package/dist/solid-ui.esm.min.js.map +1 -1
- package/dist/solid-ui.js +496 -827
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +12 -12
- package/dist/solid-ui.min.js.map +1 -1
- package/dist/versionInfo.js +2 -2
- package/dist/widgets/buttons.js +20 -20
- package/dist/widgets/buttons.js.map +1 -1
- package/package.json +132 -133
- package/dist/theme-accessibility.css +0 -147
- package/dist/theme-classic.css +0 -70
- package/dist/theme-default.css +0 -65
- package/dist/theme-signal.css +0 -65
- package/dist/theme-telegram.css +0 -65
- package/dist/theme-variables.css +0 -163
- package/dist/theme-wave.css +0 -65
- package/dist/themes-README.md +0 -254
package/dist/themes-README.md
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
# Solid-UI Theme System
|
|
2
|
-
|
|
3
|
-
**Phase 1: Foundation** - CSS Variables & Runtime Theme Switching
|
|
4
|
-
|
|
5
|
-
## 🎨 Live Demo
|
|
6
|
-
|
|
7
|
-
**[Open Theme Demo](../../docs/theme-demo.html)** - Interactive preview of all 5 themes (no setup required, works offline)
|
|
8
|
-
|
|
9
|
-
This standalone demo file can be:
|
|
10
|
-
- Shared with team members via email or Slack
|
|
11
|
-
- Attached to GitHub issues/PRs for visual review
|
|
12
|
-
- Opened directly in any browser for quick testing
|
|
13
|
-
|
|
14
|
-
## Overview
|
|
15
|
-
|
|
16
|
-
The Solid-UI theme system provides modern, customizable styling using CSS custom properties (variables). It supports multiple built-in themes and allows runtime theme switching with localStorage persistence.
|
|
17
|
-
|
|
18
|
-
## Architecture
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
src/themes/
|
|
22
|
-
├── foundation/
|
|
23
|
-
│ ├── variables.css # Base CSS custom properties
|
|
24
|
-
│ └── accessibility.css # WCAG 2.1 AA compliance features
|
|
25
|
-
└── presets/
|
|
26
|
-
├── classic.css # Original solid-ui appearance (default)
|
|
27
|
-
├── default.css # Modern purple gradient (Solid style)
|
|
28
|
-
├── wave.css # WhatsApp-style green
|
|
29
|
-
├── telegram.css # Messenger-style blue
|
|
30
|
-
└── signal.css # Signal-style blue
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Usage
|
|
34
|
-
|
|
35
|
-
### Automatic Initialization
|
|
36
|
-
|
|
37
|
-
The theme system auto-initializes on page load and applies the saved theme preference (or "classic" by default):
|
|
38
|
-
|
|
39
|
-
```javascript
|
|
40
|
-
import { themeLoader } from 'solid-ui'
|
|
41
|
-
|
|
42
|
-
// Theme system initializes automatically
|
|
43
|
-
// Loads foundation CSS + saved theme from localStorage
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Switching Themes Programmatically
|
|
47
|
-
|
|
48
|
-
```javascript
|
|
49
|
-
import { themeLoader } from 'solid-ui'
|
|
50
|
-
|
|
51
|
-
// Switch to a theme
|
|
52
|
-
await themeLoader.loadTheme('wave')
|
|
53
|
-
|
|
54
|
-
// Get current theme
|
|
55
|
-
const currentTheme = themeLoader.getCurrentTheme() // 'wave'
|
|
56
|
-
|
|
57
|
-
// Get available themes
|
|
58
|
-
const themes = themeLoader.getAvailableThemes()
|
|
59
|
-
// Returns: [{ name: 'classic', label: 'Classic' }, ...]
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Listen for Theme Changes
|
|
63
|
-
|
|
64
|
-
```javascript
|
|
65
|
-
window.addEventListener('solid-ui-theme-change', (event) => {
|
|
66
|
-
console.log('Theme changed to:', event.detail.theme)
|
|
67
|
-
})
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Using in Components
|
|
71
|
-
|
|
72
|
-
The `style` object now uses CSS variables with fallbacks:
|
|
73
|
-
|
|
74
|
-
```javascript
|
|
75
|
-
import { style } from 'solid-ui'
|
|
76
|
-
|
|
77
|
-
// Styles automatically adapt to active theme
|
|
78
|
-
const input = document.createElement('input')
|
|
79
|
-
input.style = style.textInputStyle
|
|
80
|
-
// Uses var(--sui-bg-input) from active theme, falls back to #eef
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Available Themes
|
|
84
|
-
|
|
85
|
-
### Classic (Default)
|
|
86
|
-
- **Colors**: Original solid-ui palette (#3B5998, #eef, #888)
|
|
87
|
-
- **Style**: Preserves exact original appearance
|
|
88
|
-
- **Use case**: Backward compatibility, no visual changes
|
|
89
|
-
|
|
90
|
-
### Default (Solid)
|
|
91
|
-
- **Colors**: Modern purple gradient (#667eea, #9f7aea)
|
|
92
|
-
- **Style**: Clean, modern with improved spacing
|
|
93
|
-
- **Use case**: New projects, modern look
|
|
94
|
-
|
|
95
|
-
### Wave
|
|
96
|
-
- **Colors**: WhatsApp green (#128c7e, #075e54)
|
|
97
|
-
- **Style**: Clean messenger style
|
|
98
|
-
- **Use case**: Familiar, friendly interface
|
|
99
|
-
|
|
100
|
-
### Telegram
|
|
101
|
-
- **Colors**: Telegram blue (#0088cc, #0078b8)
|
|
102
|
-
- **Style**: Professional messenger
|
|
103
|
-
- **Use case**: Business, clean interface
|
|
104
|
-
|
|
105
|
-
### Signal
|
|
106
|
-
- **Colors**: Signal blue (#2c6bed, #1851c4)
|
|
107
|
-
- **Style**: Privacy-focused, professional
|
|
108
|
-
- **Use case**: Security-focused apps
|
|
109
|
-
|
|
110
|
-
## CSS Variables Reference
|
|
111
|
-
|
|
112
|
-
### Colors
|
|
113
|
-
```css
|
|
114
|
-
--sui-primary: #805ad5;
|
|
115
|
-
--sui-accent: #9f7aea;
|
|
116
|
-
--sui-bg: #f7f8fc;
|
|
117
|
-
--sui-bg-panel: #ffffff;
|
|
118
|
-
--sui-text: #2d3748;
|
|
119
|
-
--sui-text-secondary: #4a5568;
|
|
120
|
-
--sui-border-color: #e2e8f0;
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### Spacing
|
|
124
|
-
```css
|
|
125
|
-
--sui-space-xs: 0.25em;
|
|
126
|
-
--sui-space-sm: 0.5em;
|
|
127
|
-
--sui-space-md: 1em;
|
|
128
|
-
--sui-space-lg: 1.5em;
|
|
129
|
-
--sui-space-xl: 2em;
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Border Radius
|
|
133
|
-
```css
|
|
134
|
-
--sui-border-radius: 0.5em;
|
|
135
|
-
--sui-border-radius-sm: 0.3em;
|
|
136
|
-
--sui-border-radius-lg: 1em;
|
|
137
|
-
--sui-border-radius-full: 50%;
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Shadows
|
|
141
|
-
```css
|
|
142
|
-
--sui-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
|
|
143
|
-
--sui-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
144
|
-
--sui-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
See `foundation/variables.css` for the complete list.
|
|
148
|
-
|
|
149
|
-
## Creating Custom Themes
|
|
150
|
-
|
|
151
|
-
Create a new CSS file in `presets/`:
|
|
152
|
-
|
|
153
|
-
```css
|
|
154
|
-
/* src/themes/presets/mytheme.css */
|
|
155
|
-
:root {
|
|
156
|
-
--sui-primary: #your-color;
|
|
157
|
-
--sui-accent: #your-accent;
|
|
158
|
-
/* Override other variables as needed */
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
Register the theme:
|
|
163
|
-
|
|
164
|
-
```javascript
|
|
165
|
-
import { themeLoader } from 'solid-ui'
|
|
166
|
-
|
|
167
|
-
themeLoader.themes.mytheme = 'themes/presets/mytheme.css'
|
|
168
|
-
await themeLoader.loadTheme('mytheme')
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
## Accessibility Features
|
|
172
|
-
|
|
173
|
-
All themes include WCAG 2.1 Level AA compliance features:
|
|
174
|
-
|
|
175
|
-
- **Focus Indicators**: Visible 2px outlines
|
|
176
|
-
- **High Contrast Mode**: Automatic adaptation
|
|
177
|
-
- **Reduced Motion**: Respects user preference
|
|
178
|
-
- **Touch Targets**: Minimum 44x44px
|
|
179
|
-
- **Screen Reader Support**: `.sr-only` utility class
|
|
180
|
-
|
|
181
|
-
See `foundation/accessibility.css` for details.
|
|
182
|
-
|
|
183
|
-
## Browser Support
|
|
184
|
-
|
|
185
|
-
CSS custom properties are supported in:
|
|
186
|
-
- ✅ Chrome/Edge 49+
|
|
187
|
-
- ✅ Firefox 31+
|
|
188
|
-
- ✅ Safari 9.1+
|
|
189
|
-
- ✅ iOS Safari 9.3+
|
|
190
|
-
- ✅ Android Browser 76+
|
|
191
|
-
|
|
192
|
-
For older browsers, fallback values ensure basic functionality.
|
|
193
|
-
|
|
194
|
-
## Migration from Inline Styles
|
|
195
|
-
|
|
196
|
-
The style.js file now uses a hybrid approach:
|
|
197
|
-
|
|
198
|
-
**Before (hard-coded)**:
|
|
199
|
-
```javascript
|
|
200
|
-
background-color: #eef;
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
**After (with CSS variable + fallback)**:
|
|
204
|
-
```javascript
|
|
205
|
-
background-color: var(--sui-bg-input, #eef);
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
This maintains backward compatibility while enabling theming.
|
|
209
|
-
|
|
210
|
-
## Performance
|
|
211
|
-
|
|
212
|
-
- CSS variables have negligible performance impact
|
|
213
|
-
- Theme files are ~2-4KB each (gzipped)
|
|
214
|
-
- Theme switching is near-instant (<100ms)
|
|
215
|
-
- Foundation CSS loads once and caches
|
|
216
|
-
|
|
217
|
-
## Troubleshooting
|
|
218
|
-
|
|
219
|
-
### Theme not loading?
|
|
220
|
-
Check browser console for errors. Verify CSS file paths are correct relative to your build output.
|
|
221
|
-
|
|
222
|
-
### Styles not updating?
|
|
223
|
-
Hard refresh (Ctrl+Shift+R) to clear cached CSS. Check that CSS variables are defined in your theme file.
|
|
224
|
-
|
|
225
|
-
### Want to disable auto-init?
|
|
226
|
-
```javascript
|
|
227
|
-
// In your app's entry point, before solid-ui loads:
|
|
228
|
-
window.SOLID_UI_SKIP_THEME_INIT = true
|
|
229
|
-
|
|
230
|
-
// Then manually init later:
|
|
231
|
-
import { themeLoader } from 'solid-ui'
|
|
232
|
-
await themeLoader.init()
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
## Future Enhancements
|
|
236
|
-
|
|
237
|
-
Phase 1 establishes the foundation. Future phases will add:
|
|
238
|
-
- Theme picker widget
|
|
239
|
-
- Component-specific theme overrides
|
|
240
|
-
- Dark mode variants
|
|
241
|
-
- Community theme marketplace
|
|
242
|
-
|
|
243
|
-
## Contributing
|
|
244
|
-
|
|
245
|
-
When adding new styles:
|
|
246
|
-
1. Use CSS variables with fallbacks
|
|
247
|
-
2. Test with all 5 themes
|
|
248
|
-
3. Verify accessibility (contrast, focus, etc.)
|
|
249
|
-
4. Update this documentation
|
|
250
|
-
|
|
251
|
-
---
|
|
252
|
-
|
|
253
|
-
**Status**: Phase 1 Complete ✅
|
|
254
|
-
**Next**: Phase 2 - Component Modernization
|