wacom 21.1.12 → 21.1.13
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 +44 -13
- package/fesm2022/wacom.mjs +9 -0
- package/fesm2022/wacom.mjs.map +1 -1
- package/package.json +1 -1
- package/types/wacom.d.ts +8 -5
package/README.md
CHANGED
|
@@ -63,8 +63,9 @@ export const appConfig = {
|
|
|
63
63
|
| [**`Dom`**](https://www.npmjs.com/package/wacom#dom-service) | Facilitates DOM manipulation and dynamic component loading |
|
|
64
64
|
| [**`Network`**](https://www.npmjs.com/package/wacom#network-service) | Monitors network connectivity and latency |
|
|
65
65
|
| [**`RTC`**](https://www.npmjs.com/package/wacom#rtc-service) | Wraps WebRTC peer connections and local media streams |
|
|
66
|
-
| [**`Util`**](https://www.npmjs.com/package/wacom#util-service) | Utility methods for forms, validation, and CSS variables |
|
|
67
|
-
| [**`
|
|
66
|
+
| [**`Util`**](https://www.npmjs.com/package/wacom#util-service) | Utility methods for forms, validation, and CSS variables |
|
|
67
|
+
| [**`Theme`**](#theme-service) | Manages UI theme mode, density, and radius preferences |
|
|
68
|
+
| [**`Emitter`**](#emitter-service) | Lightweight app-wide event and task signaling |
|
|
68
69
|
|
|
69
70
|
## [Emitter Service](#emitter-service)
|
|
70
71
|
|
|
@@ -1999,7 +2000,7 @@ const weeksInMonth = timeService.getWeeksInMonth(2, 2025);
|
|
|
1999
2000
|
console.log(weeksInMonth); // Output: 6 (example for March 2025)
|
|
2000
2001
|
```
|
|
2001
2002
|
|
|
2002
|
-
## [Dom Service](#dom-service)
|
|
2003
|
+
## [Dom Service](#dom-service)
|
|
2003
2004
|
|
|
2004
2005
|
The `DomService` facilitates DOM manipulation and dynamic component loading in Angular applications.
|
|
2005
2006
|
|
|
@@ -2109,7 +2110,7 @@ export class AppComponent {
|
|
|
2109
2110
|
}
|
|
2110
2111
|
```
|
|
2111
2112
|
|
|
2112
|
-
## [Network Service](#network-service)
|
|
2113
|
+
## [Network Service](#network-service)
|
|
2113
2114
|
|
|
2114
2115
|
The `NetworkService` monitors network connectivity and latency using Angular signals.
|
|
2115
2116
|
It periodically probes configurable endpoints and emits `wacom_online` or `wacom_offline`
|
|
@@ -2133,7 +2134,7 @@ Performs an immediate connectivity check and updates all signals.
|
|
|
2133
2134
|
await networkService.recheckNow();
|
|
2134
2135
|
```
|
|
2135
2136
|
|
|
2136
|
-
## [RTC Service](#rtc-service)
|
|
2137
|
+
## [RTC Service](#rtc-service)
|
|
2137
2138
|
|
|
2138
2139
|
The `RtcService` wraps WebRTC peer connections and local media streams.
|
|
2139
2140
|
|
|
@@ -2152,14 +2153,44 @@ The `RtcService` wraps WebRTC peer connections and local media streams.
|
|
|
2152
2153
|
**Example**:
|
|
2153
2154
|
|
|
2154
2155
|
```Typescript
|
|
2155
|
-
import { RtcService } from 'wacom';
|
|
2156
|
+
import { RtcService } from 'wacom';
|
|
2156
2157
|
|
|
2157
2158
|
constructor(private rtc: RtcService) {}
|
|
2158
2159
|
|
|
2159
|
-
async connect(id: string) {
|
|
2160
|
-
await this.rtc.initLocalStream();
|
|
2161
|
-
await this.rtc.createPeer(id);
|
|
2162
|
-
const offer = await this.rtc.createOffer(id);
|
|
2163
|
-
// send offer to remote peer...
|
|
2164
|
-
}
|
|
2165
|
-
```
|
|
2160
|
+
async connect(id: string) {
|
|
2161
|
+
await this.rtc.initLocalStream();
|
|
2162
|
+
await this.rtc.createPeer(id);
|
|
2163
|
+
const offer = await this.rtc.createOffer(id);
|
|
2164
|
+
// send offer to remote peer...
|
|
2165
|
+
}
|
|
2166
|
+
```
|
|
2167
|
+
|
|
2168
|
+
## [Theme Service](#theme-service)
|
|
2169
|
+
|
|
2170
|
+
The `ThemeService` manages UI theme preferences by setting data attributes on the
|
|
2171
|
+
document root and persisting them in `localStorage`.
|
|
2172
|
+
|
|
2173
|
+
### Methods
|
|
2174
|
+
|
|
2175
|
+
- `getMode(): ThemeMode | null` – reads `theme.mode` from `localStorage`.
|
|
2176
|
+
- `setMode(mode: ThemeMode): void` – sets `data-mode` and persists `theme.mode`.
|
|
2177
|
+
- `getDensity(): ThemeDensity | null` – reads `theme.density` from `localStorage`.
|
|
2178
|
+
- `setDensity(density: ThemeDensity): void` – sets `data-density` and persists `theme.density`.
|
|
2179
|
+
- `getRadius(): ThemeRadius | string | null` – reads `theme.radius` from `localStorage`.
|
|
2180
|
+
- `setRadius(radius: ThemeRadius | string): void` – sets `data-radius` and persists `theme.radius`.
|
|
2181
|
+
- `init(): void` – loads preferences from `localStorage` (or defaults to `light`, `comfortable`, `rounded`).
|
|
2182
|
+
|
|
2183
|
+
### Usage Example
|
|
2184
|
+
|
|
2185
|
+
```Typescript
|
|
2186
|
+
import { ThemeService } from "wacom";
|
|
2187
|
+
|
|
2188
|
+
constructor(private theme: ThemeService) {}
|
|
2189
|
+
|
|
2190
|
+
ngOnInit() {
|
|
2191
|
+
this.theme.init();
|
|
2192
|
+
this.theme.setMode("dark");
|
|
2193
|
+
this.theme.setDensity("compact");
|
|
2194
|
+
this.theme.setRadius("square");
|
|
2195
|
+
}
|
|
2196
|
+
```
|
package/fesm2022/wacom.mjs
CHANGED
|
@@ -4199,14 +4199,23 @@ class ThemeService {
|
|
|
4199
4199
|
constructor() {
|
|
4200
4200
|
this.doc = inject(DOCUMENT);
|
|
4201
4201
|
}
|
|
4202
|
+
getRadius() {
|
|
4203
|
+
return localStorage.getItem('theme.radius');
|
|
4204
|
+
}
|
|
4202
4205
|
setRadius(radius) {
|
|
4203
4206
|
this.doc.documentElement.dataset['radius'] = radius;
|
|
4204
4207
|
localStorage.setItem('theme.radius', radius);
|
|
4205
4208
|
}
|
|
4209
|
+
getMode() {
|
|
4210
|
+
return localStorage.getItem('theme.mode');
|
|
4211
|
+
}
|
|
4206
4212
|
setMode(mode) {
|
|
4207
4213
|
this.doc.documentElement.dataset['mode'] = mode;
|
|
4208
4214
|
localStorage.setItem('theme.mode', mode);
|
|
4209
4215
|
}
|
|
4216
|
+
getDensity() {
|
|
4217
|
+
return localStorage.getItem('theme.density');
|
|
4218
|
+
}
|
|
4210
4219
|
setDensity(density) {
|
|
4211
4220
|
this.doc.documentElement.dataset['density'] = density;
|
|
4212
4221
|
localStorage.setItem('theme.density', density);
|