wacom 21.2.5 → 21.2.7
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 +39 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Module which has common services, pipes, directives and interfaces which can be used on all projects.
|
|
4
4
|
|
|
5
|
+
Wacom is SSR-safe and works with Angular Universal: browser-only APIs are guarded, and features that require a browser runtime activate only on the client.
|
|
6
|
+
|
|
5
7
|
## License
|
|
6
8
|
|
|
7
9
|
[MIT](LICENSE)
|
|
@@ -66,7 +68,7 @@ export const appConfig = {
|
|
|
66
68
|
| [**`RTC`**](https://www.npmjs.com/package/wacom#rtc-service) | Wraps WebRTC peer connections and local media streams |
|
|
67
69
|
| [**`Util`**](https://www.npmjs.com/package/wacom#util-service) | Utility methods for forms, validation, and CSS variables |
|
|
68
70
|
| [**`Theme`**](#theme-service) | Manages UI theme mode, density, and radius preferences |
|
|
69
|
-
| [**`Translate`**](#translate-service) |
|
|
71
|
+
| [**`Translate`**](#translate-service) | Lightweight, signal-based runtime translate engine |
|
|
70
72
|
|
|
71
73
|
## [Core Service](#core-service)
|
|
72
74
|
|
|
@@ -2144,7 +2146,7 @@ ngOnInit() {
|
|
|
2144
2146
|
}
|
|
2145
2147
|
```
|
|
2146
2148
|
|
|
2147
|
-
## [Translate Service](#translate-service)
|
|
2149
|
+
## [Translate Service](#translate-service)
|
|
2148
2150
|
|
|
2149
2151
|
Wacom includes a lightweight, signal-based runtime translation engine built for Angular Signals.
|
|
2150
2152
|
|
|
@@ -2160,13 +2162,13 @@ Unlike compile-time Angular i18n, this works fully at runtime.
|
|
|
2160
2162
|
|
|
2161
2163
|
---
|
|
2162
2164
|
|
|
2163
|
-
### Translate model
|
|
2165
|
+
### Translate model
|
|
2164
2166
|
|
|
2165
2167
|
```ts
|
|
2166
|
-
export interface Translate {
|
|
2167
|
-
sourceText: string;
|
|
2168
|
-
text: string;
|
|
2169
|
-
}
|
|
2168
|
+
export interface Translate {
|
|
2169
|
+
sourceText: string;
|
|
2170
|
+
text: string;
|
|
2171
|
+
}
|
|
2170
2172
|
```
|
|
2171
2173
|
|
|
2172
2174
|
Each `sourceText` acts as both:
|
|
@@ -2179,11 +2181,11 @@ Each `sourceText` acts as both:
|
|
|
2179
2181
|
### Basic usage (signal API)
|
|
2180
2182
|
|
|
2181
2183
|
```ts
|
|
2182
|
-
import { TranslateService } from "wacom";
|
|
2183
|
-
|
|
2184
|
-
private _translateService = inject(TranslateService);
|
|
2185
|
-
|
|
2186
|
-
title = this._translateService.translate("Create project");
|
|
2184
|
+
import { TranslateService } from "wacom";
|
|
2185
|
+
|
|
2186
|
+
private _translateService = inject(TranslateService);
|
|
2187
|
+
|
|
2188
|
+
title = this._translateService.translate("Create project");
|
|
2187
2189
|
```
|
|
2188
2190
|
|
|
2189
2191
|
The returned value is a `WritableSignal<string>`.
|
|
@@ -2201,7 +2203,7 @@ automatically.
|
|
|
2201
2203
|
### Updating translations in bulk (language switch)
|
|
2202
2204
|
|
|
2203
2205
|
```ts
|
|
2204
|
-
this._translateService.setMany([
|
|
2206
|
+
this._translateService.setMany([
|
|
2205
2207
|
{ sourceText: 'Create project', text: 'Створити проєкт' },
|
|
2206
2208
|
{ sourceText: 'Save', text: 'Зберегти' },
|
|
2207
2209
|
]);
|
|
@@ -2218,7 +2220,7 @@ Behavior:
|
|
|
2218
2220
|
### Updating a single translation
|
|
2219
2221
|
|
|
2220
2222
|
```ts
|
|
2221
|
-
this._translateService.setOne({
|
|
2223
|
+
this._translateService.setOne({
|
|
2222
2224
|
sourceText: 'Save',
|
|
2223
2225
|
text: 'Зберегти',
|
|
2224
2226
|
});
|
|
@@ -2263,9 +2265,31 @@ Optional explicit key:
|
|
|
2263
2265
|
|
|
2264
2266
|
### Persistence
|
|
2265
2267
|
|
|
2266
|
-
Translate entries are automatically:
|
|
2268
|
+
Translate entries are automatically:
|
|
2267
2269
|
|
|
2268
2270
|
- hydrated from storage on startup
|
|
2269
2271
|
- synced after every update
|
|
2270
2272
|
|
|
2271
2273
|
No extra config required.
|
|
2274
|
+
|
|
2275
|
+
## AGENTS.md
|
|
2276
|
+
|
|
2277
|
+
Copy below code into AGENTS.md file of your project while you are using our plugin.
|
|
2278
|
+
|
|
2279
|
+
```md
|
|
2280
|
+
- This project uses `wacom`, an Angular utility library for shared services, directives, pipes, and app-level configuration.
|
|
2281
|
+
- Prefer bootstrapping with `provideWacom({...})` in application providers. Use `WacomModule` / `WacomModule.forRoot()` only for legacy NgModule-based apps.
|
|
2282
|
+
- Put library-wide configuration in `provideWacom()` instead of scattering it across components. Available config areas include `http`, `store`, `meta`, `network`, and optional `socket` / `io`.
|
|
2283
|
+
- Prefer the library services before adding duplicate app utilities:
|
|
2284
|
+
- `HttpService` for API calls and shared headers/base URL handling.
|
|
2285
|
+
- `StoreService` for persisted local storage values.
|
|
2286
|
+
- `MetaService` for title, description, robots, image, and link tags.
|
|
2287
|
+
- `CrudService` for data flows that need offline-aware syncing behavior.
|
|
2288
|
+
- `EmitterService`, `NetworkService`, `SocketService`, `RtcService`, `TimeService`, and `UtilService` when their built-in behavior matches the need.
|
|
2289
|
+
- Prefer importing the specific Wacom directives, pipes, and translation helpers you need instead of wrapping the whole library again in another shared abstraction.
|
|
2290
|
+
- For metadata, prefer configuring defaults in `provideWacom({ meta: ... })` and using `MetaService` or route metadata. If route-driven updates are expected, prefer `meta.applyFromRoutes = true`; use `MetaGuard` only when that flow specifically needs a guard.
|
|
2291
|
+
- For translations, register app translations with `provideTranslate(...)` and use the exported translation pipe/directive rather than creating another parallel translation bootstrap path.
|
|
2292
|
+
- Keep SSR-safe behavior intact. Do not add unguarded direct access to browser-only globals such as `window`, `document`, storage, media devices, or WebRTC APIs when Wacom already provides a guarded service for that area.
|
|
2293
|
+
- When changing app behavior, prefer configuring or composing Wacom services first before modifying the library source.
|
|
2294
|
+
- Common reusable building blocks exported by the library include `clickOutside`, manual form-related directives, translation helpers, and array/search/safe/pagination-style pipes.
|
|
2295
|
+
```
|