@telperion/ng-pack 1.3.1 → 1.4.1

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,5 +1,9 @@
1
1
  # @telperion/ng-pack
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@telperion/ng-pack.svg)](https://www.npmjs.com/package/@telperion/ng-pack)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@telperion/ng-pack.svg)](https://www.npmjs.com/package/@telperion/ng-pack)
5
+ [![License](https://img.shields.io/npm/l/@telperion/ng-pack.svg)](https://github.com/telperiontech/telperion/blob/main/libs/ng-pack/LICENSE)
6
+
3
7
  A collection of Angular utilities and libraries
4
8
 
5
9
  ## Installation
@@ -14,15 +18,17 @@ npm install @telperion/ng-pack
14
18
 
15
19
  **Import:** `@telperion/ng-pack/storage-signals`
16
20
 
17
- Angular signals-based wrapper for browser's localStorage and sessionStorage with reactive updates.
21
+ Angular signals-based wrapper for browser's localStorage, sessionStorage, and cookies with reactive updates.
18
22
 
19
23
  #### Key Features
20
24
 
21
25
  - 🚀 Signal-based API integrated with Angular's signal system
22
26
  - 🔄 Reactive updates automatically synced across components
23
27
  - 🎯 Nested property access using dot notation
24
- - 🏪 Support for both localStorage and sessionStorage
28
+ - 🏪 Support for localStorage, sessionStorage, and cookies
25
29
  - 🔑 Namespaced storage organization
30
+ - 🍪 Full cookie configuration (secure, sameSite, maxAge, etc.)
31
+ - 🔗 Cross-instance synchronization for cookie storage
26
32
 
27
33
  #### Quick Start
28
34
 
@@ -56,6 +62,47 @@ export class SettingsComponent {
56
62
  }
57
63
  ```
58
64
 
65
+ **Cookie Storage:**
66
+
67
+ ```typescript
68
+ import { ApplicationConfig } from '@angular/core';
69
+ import { provideCookieStorage } from '@telperion/ng-pack/storage-signals';
70
+
71
+ export const appConfig: ApplicationConfig = {
72
+ providers: [
73
+ provideCookieStorage('my-app', {
74
+ secure: true,
75
+ sameSite: 'strict',
76
+ maxAge: 86400 // 24 hours
77
+ }),
78
+ ]
79
+ };
80
+ ```
81
+
82
+ ```typescript
83
+ import { Component } from '@angular/core';
84
+ import { cookieStorageSignal } from '@telperion/ng-pack/storage-signals';
85
+
86
+ @Component({
87
+ selector: 'app-auth',
88
+ template: `
89
+ <div>
90
+ @if (authToken()) {
91
+ <button (click)="authToken.delete()">Logout</button>
92
+ } @else {
93
+ <button (click)="authToken.set('token123')">Login</button>
94
+ }
95
+ </div>
96
+ `
97
+ })
98
+ export class AuthComponent {
99
+ // Cookie with custom expiry
100
+ authToken = cookieStorageSignal<string>('auth', 'token', {
101
+ maxAge: 3600 // 1 hour
102
+ });
103
+ }
104
+ ```
105
+
59
106
  [Full documentation →](https://github.com/telperiontech/telperion/tree/main/libs/ng-pack/storage-signals)
60
107
 
61
108
  ---