wacom 21.1.12 → 21.1.14
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 +56 -26
- package/fesm2022/wacom.mjs +255 -133
- package/fesm2022/wacom.mjs.map +1 -1
- package/package.json +1 -1
- package/types/wacom.d.ts +52 -34
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,
|
|
@@ -64,6 +64,7 @@ export const appConfig = {
|
|
|
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
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 |
|
|
67
68
|
| [**`Emitter`**](#emitter-service) | Lightweight app-wide event and task signaling |
|
|
68
69
|
|
|
69
70
|
## [Emitter Service](#emitter-service)
|
|
@@ -502,7 +503,7 @@ In this example:
|
|
|
502
503
|
|
|
503
504
|
This ensures controlled access to the resource, preventing race conditions and ensuring data integrity.
|
|
504
505
|
|
|
505
|
-
## [Http Service](#http-service)
|
|
506
|
+
## [Http Service](#http-service)
|
|
506
507
|
|
|
507
508
|
The `HttpService` provides an HTTP layer for `HttpClient` in Angular, supporting both callbacks and observables for various HTTP operations.
|
|
508
509
|
|
|
@@ -972,7 +973,7 @@ Sets the title and optional title suffix, updating the `title`, `og:title`, and
|
|
|
972
973
|
metaService.setTitle('My Page Title', ' | My Website');
|
|
973
974
|
```
|
|
974
975
|
|
|
975
|
-
#### `setLink(links: { [key: string]: string }): void`
|
|
976
|
+
#### `setLink(links: { [key: string]: string }): void`
|
|
976
977
|
|
|
977
978
|
Sets link tags.
|
|
978
979
|
|
|
@@ -1431,13 +1432,13 @@ interface CrudDocument {
|
|
|
1431
1432
|
|
|
1432
1433
|
```typescript
|
|
1433
1434
|
import { Injectable } from "@angular/core";
|
|
1434
|
-
import {
|
|
1435
|
-
CoreService,
|
|
1436
|
-
HttpService,
|
|
1437
|
-
StoreService,
|
|
1438
|
-
CrudService,
|
|
1439
|
-
CrudDocument,
|
|
1440
|
-
} from "wacom";
|
|
1435
|
+
import {
|
|
1436
|
+
CoreService,
|
|
1437
|
+
HttpService,
|
|
1438
|
+
StoreService,
|
|
1439
|
+
CrudService,
|
|
1440
|
+
CrudDocument,
|
|
1441
|
+
} from "wacom";
|
|
1441
1442
|
|
|
1442
1443
|
export interface Work extends CrudDocument {
|
|
1443
1444
|
name: string;
|
|
@@ -1450,19 +1451,15 @@ export interface Work extends CrudDocument {
|
|
|
1450
1451
|
export class WorkService extends CrudService<Work> {
|
|
1451
1452
|
works: Work[] = this.getDocs();
|
|
1452
1453
|
|
|
1453
|
-
constructor(
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
_http,
|
|
1463
|
-
_store,
|
|
1464
|
-
_core,
|
|
1465
|
-
);
|
|
1454
|
+
constructor(_http: HttpService, _store: StoreService, _core: CoreService) {
|
|
1455
|
+
super(
|
|
1456
|
+
{
|
|
1457
|
+
name: "work",
|
|
1458
|
+
},
|
|
1459
|
+
_http,
|
|
1460
|
+
_store,
|
|
1461
|
+
_core,
|
|
1462
|
+
);
|
|
1466
1463
|
|
|
1467
1464
|
this.get();
|
|
1468
1465
|
}
|
|
@@ -2163,3 +2160,36 @@ async connect(id: string) {
|
|
|
2163
2160
|
// send offer to remote peer...
|
|
2164
2161
|
}
|
|
2165
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
|
+
```
|