Skip to content

Commit 7afbe0e

Browse files
docs(demo): Add live demo link
1 parent 327b8ac commit 7afbe0e

File tree

3 files changed

+79
-9
lines changed

3 files changed

+79
-9
lines changed

README.md

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ The main service that manages theme state using Angular signals.
208208
- `theme()` - Readonly signal for current theme setting
209209
- `systemTheme()` - Readonly signal for system theme preference
210210
- `resolvedTheme()` - Computed signal for the actual applied theme
211+
- `initialized` - Boolean property indicating if service is initialized
212+
- `isForced` - Boolean property indicating if forced theme is active
211213

212214
#### Methods
213215

@@ -216,8 +218,8 @@ The main service that manages theme state using Angular signals.
216218
- `isDark()` - Check if current theme is dark
217219
- `isLight()` - Check if current theme is light
218220
- `isSystem()` - Check if using system theme
219-
- `isForced()` - Check if forced theme is active
220-
- `initialized` - Check if service is initialized
221+
- `getConfig()` - Get current configuration
222+
- `cleanup()` - Manual cleanup (automatically called on destroy)
221223

222224
### Example Usage
223225

@@ -252,6 +254,38 @@ export class ExampleComponent {
252254
}
253255
```
254256

257+
## 🔄 Lifecycle Management
258+
259+
The ThemeService automatically handles cleanup when the application is destroyed. However, you can also manually manage the lifecycle:
260+
261+
### Manual Cleanup
262+
263+
```typescript
264+
import { Component, inject, OnDestroy } from '@angular/core';
265+
import { ThemeService } from '@angularui/theme';
266+
267+
@Component({
268+
selector: 'app-example',
269+
template: `...`
270+
})
271+
export class ExampleComponent implements OnDestroy {
272+
private themeService = inject(ThemeService);
273+
274+
ngOnDestroy() {
275+
// Manual cleanup (optional - automatic cleanup is handled)
276+
this.themeService.cleanup();
277+
}
278+
}
279+
```
280+
281+
### Configuration Access
282+
283+
```typescript
284+
// Get current configuration
285+
const config = this.themeService.getConfig();
286+
console.log('Current config:', config);
287+
```
288+
255289
## 🎨 Theming Strategies
256290

257291
### Class Strategy (Recommended for Tailwind)
@@ -365,8 +399,8 @@ effect(() => {
365399

366400
## 📦 Bundle Size
367401

368-
- **Core package**: ~3KB (gzipped)
369-
- **Zero dependencies** - Only Angular core
402+
- **Core package**: ~13KB (raw) / ~3KB (gzipped)
403+
- **Zero external dependencies** - Only Angular core and common
370404
- **Tree-shakeable** - Unused features are removed
371405

372406
## 🤝 Contributing

projects/theme/README.md

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
> **Modern Theme Management for Angular** - A lightweight, feature-rich theme library with automatic dark mode detection, SSR support, and zero configuration required.
88
9+
**🌐 [Live Demo](https://angularcafe.github.io/angularui-theme/)**
10+
911
## 🌟 Features
1012

1113
- **🎨 Automatic Theme Detection** - Supports light, dark, and system themes with OS preference detection
@@ -206,6 +208,8 @@ The main service that manages theme state using Angular signals.
206208
- `theme()` - Readonly signal for current theme setting
207209
- `systemTheme()` - Readonly signal for system theme preference
208210
- `resolvedTheme()` - Computed signal for the actual applied theme
211+
- `initialized` - Boolean property indicating if service is initialized
212+
- `isForced` - Boolean property indicating if forced theme is active
209213

210214
#### Methods
211215

@@ -214,8 +218,8 @@ The main service that manages theme state using Angular signals.
214218
- `isDark()` - Check if current theme is dark
215219
- `isLight()` - Check if current theme is light
216220
- `isSystem()` - Check if using system theme
217-
- `isForced()` - Check if forced theme is active
218-
- `initialized` - Check if service is initialized
221+
- `getConfig()` - Get current configuration
222+
- `cleanup()` - Manual cleanup (automatically called on destroy)
219223

220224
### Example Usage
221225

@@ -250,6 +254,38 @@ export class ExampleComponent {
250254
}
251255
```
252256

257+
## 🔄 Lifecycle Management
258+
259+
The ThemeService automatically handles cleanup when the application is destroyed. However, you can also manually manage the lifecycle:
260+
261+
### Manual Cleanup
262+
263+
```typescript
264+
import { Component, inject, OnDestroy } from '@angular/core';
265+
import { ThemeService } from '@angularui/theme';
266+
267+
@Component({
268+
selector: 'app-example',
269+
template: `...`
270+
})
271+
export class ExampleComponent implements OnDestroy {
272+
private themeService = inject(ThemeService);
273+
274+
ngOnDestroy() {
275+
// Manual cleanup (optional - automatic cleanup is handled)
276+
this.themeService.cleanup();
277+
}
278+
}
279+
```
280+
281+
### Configuration Access
282+
283+
```typescript
284+
// Get current configuration
285+
const config = this.themeService.getConfig();
286+
console.log('Current config:', config);
287+
```
288+
253289
## 🎨 Theming Strategies
254290

255291
### Class Strategy (Recommended for Tailwind)
@@ -363,8 +399,8 @@ effect(() => {
363399

364400
## 📦 Bundle Size
365401

366-
- **Core package**: ~3KB (gzipped)
367-
- **Zero dependencies** - Only Angular core
402+
- **Core package**: ~13KB (raw) / ~3KB (gzipped)
403+
- **Zero external dependencies** - Only Angular core and common
368404
- **Tree-shakeable** - Unused features are removed
369405

370406
## 🤝 Contributing

projects/theme/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@angularui/theme",
3-
"version": "0.0.3",
3+
"version": "0.0.4",
44
"description": "Modern Theme Management for Angular - A lightweight, feature-rich theme library with automatic dark mode detection, SSR support, and zero configuration required.",
55
"keywords": [
66
"angular",

0 commit comments

Comments
 (0)