wacom 21.0.0 → 21.0.2

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 CHANGED
@@ -1,6 +1,6 @@
1
- # Angular (ngx) common
1
+ # waw Angular (ngx) common
2
2
 
3
- Module which has common services and components which can be used on all projects.
3
+ Module which has common services, pipes, directives and interfaces which can be used on all projects.
4
4
 
5
5
  ## License
6
6
 
@@ -35,25 +35,12 @@ export const appConfig = {
35
35
  providers: [
36
36
  provideWacom({
37
37
  http: { url: "https://api.example.com" },
38
- theme: {
39
- primary: "#1976d2",
40
- secondary: "#424242",
41
- info: "#29b6f6",
42
- error: "#ef5350",
43
- success: "#66bb6a",
44
- warning: "#ffa726",
45
- question: "#fff59d",
46
- },
47
- // other optional configs
48
38
  store: { prefix: "waStore" },
49
39
  meta: {
50
40
  useTitleSuffix: false,
51
41
  warnMissingGuard: true,
52
42
  defaults: { links: {} },
53
43
  },
54
- alert: {},
55
- loader: {},
56
- modal: {},
57
44
  network: {},
58
45
  // enable and configure sockets if needed
59
46
  socket: false,
@@ -63,20 +50,6 @@ export const appConfig = {
63
50
  };
64
51
  ```
65
52
 
66
- ### Theme
67
-
68
- The `theme` section customises the colours used by Wacom components. Values are written as CSS custom properties on the document root:
69
-
70
- - `--wacom-primary`
71
- - `--wacom-secondary`
72
- - `--wacom-info`
73
- - `--wacom-error`
74
- - `--wacom-success`
75
- - `--wacom-warning`
76
- - `--wacom-question`
77
-
78
- You can reference these variables in your global styles to keep the design consistent with the library.
79
-
80
53
  ## Services
81
54
 
82
55
  | Name | Description |
@@ -87,14 +60,10 @@ You can reference these variables in your global styles to keep the design consi
87
60
  | [**`Store`**](https://www.npmjs.com/package/wacom#store-service) | Service responsible for keeping information on the device |
88
61
  | [**`Meta`**](https://www.npmjs.com/package/wacom#meta-service) | Website meta tags management within router |
89
62
  | [**`Crud`**](https://www.npmjs.com/package/wacom#crud-service) | Provides basic CRUD operations for managing data with HTTP services |
90
- | [**`File`**](https://www.npmjs.com/package/wacom#file-service) | Handles file uploads, image processing, and file management tasks |
91
63
  | [**`Socket`**](https://www.npmjs.com/package/wacom#socket-service) | Manages WebSocket connections and real-time data communication |
92
64
  | [**`Time`**](https://www.npmjs.com/package/wacom#time-service) | Provides utilities for date and time manipulation and formatting |
93
65
  | [**`Dom`**](https://www.npmjs.com/package/wacom#dom-service) | Facilitates DOM manipulation and dynamic component loading |
94
66
  | [**`Network`**](https://www.npmjs.com/package/wacom#network-service) | Monitors network connectivity and latency |
95
- | [**`Alert`**](https://www.npmjs.com/package/wacom#alert-service) | Displays configurable alert messages |
96
- | [**`Loader`**](https://www.npmjs.com/package/wacom#loader-service) | Shows and manages loading indicators |
97
- | [**`Modal`**](https://www.npmjs.com/package/wacom#modal-service) | Creates and controls modal dialogs |
98
67
  | [**`RTC`**](https://www.npmjs.com/package/wacom#rtc-service) | Wraps WebRTC peer connections and local media streams |
99
68
  | [**`Util`**](https://www.npmjs.com/package/wacom#util-service) | Utility methods for forms, validation, and CSS variables |
100
69
  | [**`Emitter`**](#emitter-service) | Lightweight app-wide event and task signaling |
@@ -1541,154 +1510,6 @@ export class WorkService extends CrudService<Work> {
1541
1510
  }
1542
1511
  ```
1543
1512
 
1544
- ## [File Service](#file-service)
1545
-
1546
- The `FileService` is designed to handle file uploads, image processing, and file management tasks in an Angular application. It interacts with the `HttpService` to send files to the server and provides utilities for image resizing and validation.
1547
-
1548
- ### Methods
1549
-
1550
- #### `add(opts: FileOptions | string): void | (() => void)`
1551
-
1552
- Adds a file input configuration.
1553
- **Parameters**:
1554
-
1555
- - `opts` (FileOptions | string): The file options or a string ID.
1556
-
1557
- **Example**:
1558
-
1559
- ```Typescript
1560
- fs.add({
1561
- id: 'fileInput',
1562
- type: 'image',
1563
- resize: 200,
1564
- cb: (dataUrl, file) => {
1565
- console.log('File processed:', dataUrl, file);
1566
- },
1567
- save: true,
1568
- });
1569
- ```
1570
-
1571
- #### `change(event: Event, info: FileOptions): void`
1572
-
1573
- Handles file input change event.
1574
- **Parameters**:
1575
-
1576
- - `event` (Event): The input change event.
1577
- - `info` (FileOptions): The file options.
1578
-
1579
- **Example**:
1580
-
1581
- ```Typescript
1582
- <input type="file" (change)="fs.change($event, fileOptions)">
1583
- ```
1584
-
1585
- #### `remove(part: string, url: string, opts: any = {}, cb: (resp: any) => void = () => {}): void | (() => void)`
1586
-
1587
- Removes a file.
1588
-
1589
- **Parameters**:
1590
-
1591
- - `part` (string): The part of the API.
1592
- - `url` (string): The URL of the file.
1593
- - `opts` (object): Additional options.
1594
- - `cb` (function): The callback function.
1595
-
1596
- **Example**:
1597
-
1598
- ```Typescript
1599
- fs.remove('images', 'https://example.com/image.jpg', {}, (resp) => {
1600
- console.log('File removed:', resp);
1601
- });
1602
- ```
1603
-
1604
- #### `uploadFiles(info: FileOptions, files: File[], cb: (resp: any) => void = () => {}): void`
1605
-
1606
- Uploads files to the server.
1607
- **Parameters**:
1608
-
1609
- - `info` (FileOptions): The file options.
1610
- - `files` (File[]): The files to upload.
1611
- - `cb` (function): The callback function.
1612
-
1613
- **Example**:
1614
-
1615
- ```Typescript
1616
- const files = document.getElementById('fileInput').files;
1617
- fs.uploadFiles(fileOptions, files, (resp) => {
1618
- console.log('Files uploaded:', resp);
1619
- });
1620
- ```
1621
-
1622
- #### `image(info: FileOptions, cb: (resp: any) => void = () => {}): void | (() => void)`
1623
-
1624
- Uploads an image to the server.
1625
- **Parameters**:
1626
-
1627
- - `info` (FileOptions): The file options.
1628
- - `cb` (function): The callback function.
1629
-
1630
- **Example**:
1631
-
1632
- ```Typescript
1633
- fs.image({
1634
- api: '/api/upload',
1635
- part: 'images',
1636
- name: 'profilePic',
1637
- }, (resp) => {
1638
- console.log('Image uploaded:', resp);
1639
- });
1640
- ```
1641
-
1642
- ### Interfaces
1643
-
1644
- #### `FileOptions`
1645
-
1646
- Represents the file options for uploading and processing files.
1647
- **Properties**:
1648
-
1649
- - `id` (string): The unique ID for the file input.
1650
- - `type` (string): The type of file ('image' or 'file').
1651
- - `resize` (number | object): The dimensions for resizing the image.
1652
- - `multiple` (boolean): Indicates if multiple files can be uploaded.
1653
- - `multiple_cb` (function): Callback function for multiple files.
1654
- - `cb` (function): Callback function for file processing.
1655
- - `save` (boolean): Indicates if the file should be saved.
1656
- - `complete` (function): Function to call when the file is saved.
1657
- - `api` (string): The API endpoint for uploading the file.
1658
- - `part` (string): The part of the API.
1659
- - `name` (string): The name of the file.
1660
- - `body` (function | object): Function or object to generate the request body.
1661
- - `resp` (function): Function to handle the response.
1662
- - `append` (function): Function to append files to FormData.
1663
- - `multiple_files` (array): Array of multiple files.
1664
- - `multiple_counter` (number): Counter for multiple files.
1665
- - `url` (string): The URL for the file.
1666
-
1667
- **Example**:
1668
-
1669
- ```Typescript
1670
- const fileOptions: FileOptions = {
1671
- id: 'fileInput',
1672
- type: 'image',
1673
- resize: { width: 200, height: 200 },
1674
- multiple: true,
1675
- multiple_cb: (files) => {
1676
- console.log('Multiple files processed:', files);
1677
- },
1678
- cb: (dataUrl, file) => {
1679
- console.log('File processed:', dataUrl, file);
1680
- },
1681
- save: true,
1682
- api: '/api/upload',
1683
- part: 'images',
1684
- name: 'profilePic',
1685
- body: () => ({ userId: 123 }),
1686
- resp: (response) => {
1687
- console.log('Server response:', response);
1688
- },
1689
- };
1690
- ```
1691
-
1692
1513
  ## [Socket Service](#socket-service)
1693
1514
 
1694
1515
  The `SocketService` manages WebSocket connections using `socket.io`. It handles setting up the connection, listening for events, and emitting messages.
@@ -2353,117 +2174,6 @@ Performs an immediate connectivity check and updates all signals.
2353
2174
  await networkService.recheckNow();
2354
2175
  ```
2355
2176
 
2356
- ## [Alert Service](#alert-service)
2357
-
2358
- The `AlertService` displays configurable alert messages such as information, success, warning, error or question prompts.
2359
-
2360
- ### Methods
2361
-
2362
- #### `show(opts: Alert | string): Alert`
2363
-
2364
- Displays a customizable alert. Passing a string uses it as the alert text.
2365
-
2366
- #### `info(opts: Alert): void`
2367
-
2368
- Shows an informational alert.
2369
-
2370
- #### `success(opts: Alert): void`
2371
-
2372
- Shows a success alert.
2373
-
2374
- #### `warning(opts: Alert): void`
2375
-
2376
- Shows a warning alert.
2377
-
2378
- #### `error(opts: Alert): void`
2379
-
2380
- Shows an error alert.
2381
-
2382
- #### `question(opts: Alert): void`
2383
-
2384
- Shows a question alert.
2385
-
2386
- #### `destroy(): void`
2387
-
2388
- Removes all alerts.
2389
-
2390
- **Example**:
2391
-
2392
- ```Typescript
2393
- import { AlertService } from 'wacom';
2394
-
2395
- constructor(private alertService: AlertService) {}
2396
-
2397
- notify() {
2398
- this.alertService.success({ text: 'Saved!' });
2399
- }
2400
- ```
2401
-
2402
- ## [Loader Service](#loader-service)
2403
-
2404
- The `LoaderService` provides global loading indicators.
2405
-
2406
- ### Methods
2407
-
2408
- #### `show(opts: Loader | string = 'Loading...'): Loader`
2409
-
2410
- Displays a loader with optional text or configuration.
2411
-
2412
- #### `destroy(): void`
2413
-
2414
- Removes all active loaders.
2415
-
2416
- **Example**:
2417
-
2418
- ```Typescript
2419
- import { LoaderService } from 'wacom';
2420
-
2421
- constructor(private loader: LoaderService) {}
2422
-
2423
- load() {
2424
- const l = this.loader.show();
2425
- // ...do work...
2426
- l.close?.();
2427
- }
2428
- ```
2429
-
2430
- ## [Modal Service](#modal-service)
2431
-
2432
- The `ModalService` manages modal dialogs and projects components into them.
2433
-
2434
- ### Methods
2435
-
2436
- #### `show(opts: Modal | Type<unknown>): Modal`
2437
-
2438
- Opens a modal with the given configuration or component type.
2439
-
2440
- #### `small(opts: Modal): void`
2441
-
2442
- #### `mid(opts: Modal): void`
2443
-
2444
- #### `big(opts: Modal): void`
2445
-
2446
- #### `full(opts: Modal): void`
2447
-
2448
- Convenience helpers to open modals of different sizes.
2449
-
2450
- #### `destroy(): void`
2451
-
2452
- Closes all open modals.
2453
-
2454
- **Example**:
2455
-
2456
- ```Typescript
2457
- import { ModalService } from 'wacom';
2458
- import { MyComponent } from './my.component';
2459
-
2460
- constructor(private modal: ModalService) {}
2461
-
2462
- open() {
2463
- this.modal.show({ component: MyComponent, size: 'mid' });
2464
- }
2465
- ```
2466
-
2467
2177
  ## [RTC Service](#rtc-service)
2468
2178
 
2469
2179
  The `RtcService` wraps WebRTC peer connections and local media streams.