wacom 21.1.13 → 21.1.15
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 +69 -70
- package/fesm2022/wacom.mjs +340 -225
- package/fesm2022/wacom.mjs.map +1 -1
- package/package.json +1 -1
- package/types/wacom.d.ts +48 -33
package/README.md
CHANGED
|
@@ -36,10 +36,10 @@ export const appConfig = {
|
|
|
36
36
|
provideWacom({
|
|
37
37
|
http: { url: "https://api.example.com" },
|
|
38
38
|
store: { prefix: "waStore" },
|
|
39
|
-
meta: {
|
|
40
|
-
useTitleSuffix: false,
|
|
41
|
-
defaults: { links: {} },
|
|
42
|
-
},
|
|
39
|
+
meta: {
|
|
40
|
+
useTitleSuffix: false,
|
|
41
|
+
defaults: { links: {} },
|
|
42
|
+
},
|
|
43
43
|
network: {},
|
|
44
44
|
// enable and configure sockets if needed
|
|
45
45
|
socket: false,
|
|
@@ -63,9 +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
|
-
| [**`Theme`**](#theme-service)
|
|
68
|
-
| [**`Emitter`**](#emitter-service) | Lightweight app-wide event and task signaling |
|
|
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 |
|
|
69
69
|
|
|
70
70
|
## [Emitter Service](#emitter-service)
|
|
71
71
|
|
|
@@ -503,7 +503,7 @@ In this example:
|
|
|
503
503
|
|
|
504
504
|
This ensures controlled access to the resource, preventing race conditions and ensuring data integrity.
|
|
505
505
|
|
|
506
|
-
## [Http Service](#http-service)
|
|
506
|
+
## [Http Service](#http-service)
|
|
507
507
|
|
|
508
508
|
The `HttpService` provides an HTTP layer for `HttpClient` in Angular, supporting both callbacks and observables for various HTTP operations.
|
|
509
509
|
|
|
@@ -973,7 +973,7 @@ Sets the title and optional title suffix, updating the `title`, `og:title`, and
|
|
|
973
973
|
metaService.setTitle('My Page Title', ' | My Website');
|
|
974
974
|
```
|
|
975
975
|
|
|
976
|
-
#### `setLink(links: { [key: string]: string }): void`
|
|
976
|
+
#### `setLink(links: { [key: string]: string }): void`
|
|
977
977
|
|
|
978
978
|
Sets link tags.
|
|
979
979
|
|
|
@@ -1432,13 +1432,13 @@ interface CrudDocument {
|
|
|
1432
1432
|
|
|
1433
1433
|
```typescript
|
|
1434
1434
|
import { Injectable } from "@angular/core";
|
|
1435
|
-
import {
|
|
1436
|
-
CoreService,
|
|
1437
|
-
HttpService,
|
|
1438
|
-
StoreService,
|
|
1439
|
-
CrudService,
|
|
1440
|
-
CrudDocument,
|
|
1441
|
-
} from "wacom";
|
|
1435
|
+
import {
|
|
1436
|
+
CoreService,
|
|
1437
|
+
HttpService,
|
|
1438
|
+
StoreService,
|
|
1439
|
+
CrudService,
|
|
1440
|
+
CrudDocument,
|
|
1441
|
+
} from "wacom";
|
|
1442
1442
|
|
|
1443
1443
|
export interface Work extends CrudDocument {
|
|
1444
1444
|
name: string;
|
|
@@ -1451,19 +1451,15 @@ export interface Work extends CrudDocument {
|
|
|
1451
1451
|
export class WorkService extends CrudService<Work> {
|
|
1452
1452
|
works: Work[] = this.getDocs();
|
|
1453
1453
|
|
|
1454
|
-
constructor(
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
_http,
|
|
1464
|
-
_store,
|
|
1465
|
-
_core,
|
|
1466
|
-
);
|
|
1454
|
+
constructor(_http: HttpService, _store: StoreService, _core: CoreService) {
|
|
1455
|
+
super(
|
|
1456
|
+
{
|
|
1457
|
+
name: "work",
|
|
1458
|
+
},
|
|
1459
|
+
_http,
|
|
1460
|
+
_store,
|
|
1461
|
+
_core,
|
|
1462
|
+
);
|
|
1467
1463
|
|
|
1468
1464
|
this.get();
|
|
1469
1465
|
}
|
|
@@ -2000,7 +1996,7 @@ const weeksInMonth = timeService.getWeeksInMonth(2, 2025);
|
|
|
2000
1996
|
console.log(weeksInMonth); // Output: 6 (example for March 2025)
|
|
2001
1997
|
```
|
|
2002
1998
|
|
|
2003
|
-
## [Dom Service](#dom-service)
|
|
1999
|
+
## [Dom Service](#dom-service)
|
|
2004
2000
|
|
|
2005
2001
|
The `DomService` facilitates DOM manipulation and dynamic component loading in Angular applications.
|
|
2006
2002
|
|
|
@@ -2110,7 +2106,7 @@ export class AppComponent {
|
|
|
2110
2106
|
}
|
|
2111
2107
|
```
|
|
2112
2108
|
|
|
2113
|
-
## [Network Service](#network-service)
|
|
2109
|
+
## [Network Service](#network-service)
|
|
2114
2110
|
|
|
2115
2111
|
The `NetworkService` monitors network connectivity and latency using Angular signals.
|
|
2116
2112
|
It periodically probes configurable endpoints and emits `wacom_online` or `wacom_offline`
|
|
@@ -2134,7 +2130,7 @@ Performs an immediate connectivity check and updates all signals.
|
|
|
2134
2130
|
await networkService.recheckNow();
|
|
2135
2131
|
```
|
|
2136
2132
|
|
|
2137
|
-
## [RTC Service](#rtc-service)
|
|
2133
|
+
## [RTC Service](#rtc-service)
|
|
2138
2134
|
|
|
2139
2135
|
The `RtcService` wraps WebRTC peer connections and local media streams.
|
|
2140
2136
|
|
|
@@ -2153,44 +2149,47 @@ The `RtcService` wraps WebRTC peer connections and local media streams.
|
|
|
2153
2149
|
**Example**:
|
|
2154
2150
|
|
|
2155
2151
|
```Typescript
|
|
2156
|
-
import { RtcService } from 'wacom';
|
|
2152
|
+
import { RtcService } from 'wacom';
|
|
2157
2153
|
|
|
2158
2154
|
constructor(private rtc: RtcService) {}
|
|
2159
2155
|
|
|
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
|
|
2172
|
-
|
|
2173
|
-
###
|
|
2174
|
-
|
|
2175
|
-
- `
|
|
2176
|
-
- `
|
|
2177
|
-
- `
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
- `
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
this.theme.
|
|
2195
|
-
|
|
2196
|
-
|
|
2156
|
+
async connect(id: string) {
|
|
2157
|
+
await this.rtc.initLocalStream();
|
|
2158
|
+
await this.rtc.createPeer(id);
|
|
2159
|
+
const offer = await this.rtc.createOffer(id);
|
|
2160
|
+
// send offer to remote peer...
|
|
2161
|
+
}
|
|
2162
|
+
```
|
|
2163
|
+
|
|
2164
|
+
## [Theme Service](#theme-service)
|
|
2165
|
+
|
|
2166
|
+
The `ThemeService` manages UI theme preferences by setting data attributes on the
|
|
2167
|
+
document root, persisting them in `localStorage`, and exposing Angular signals.
|
|
2168
|
+
|
|
2169
|
+
### Properties
|
|
2170
|
+
|
|
2171
|
+
- `mode: Signal<ThemeMode | string | undefined>` - current theme mode.
|
|
2172
|
+
- `density: Signal<ThemeDensity | undefined>` - current density.
|
|
2173
|
+
- `radius: Signal<ThemeRadius | undefined>` - current radius.
|
|
2174
|
+
|
|
2175
|
+
### Methods
|
|
2176
|
+
|
|
2177
|
+
- `setMode(mode: ThemeMode): void` - sets `data-mode`, persists `theme.mode`, updates `mode`.
|
|
2178
|
+
- `setDensity(density: ThemeDensity): void` - sets `data-density`, persists `theme.density`, updates `density`.
|
|
2179
|
+
- `setRadius(radius: ThemeRadius): void` - sets `data-radius`, persists `theme.radius`, updates `radius`.
|
|
2180
|
+
- `init(): void` - loads preferences from `localStorage` (or defaults to `light`, `comfortable`, `rounded`) and updates signals.
|
|
2181
|
+
|
|
2182
|
+
### Usage Example
|
|
2183
|
+
|
|
2184
|
+
```Typescript
|
|
2185
|
+
import { ThemeService } from "wacom";
|
|
2186
|
+
|
|
2187
|
+
constructor(private theme: ThemeService) {}
|
|
2188
|
+
|
|
2189
|
+
ngOnInit() {
|
|
2190
|
+
this.theme.init();
|
|
2191
|
+
this.theme.setMode("dark");
|
|
2192
|
+
this.theme.setDensity("compact");
|
|
2193
|
+
this.theme.setRadius("square");
|
|
2194
|
+
}
|
|
2195
|
+
```
|