@dvirus-js/angular-signals 0.0.16 → 0.0.17

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,9 +1,9 @@
1
1
  # Angular Signals Library
2
2
 
3
- `@dvirus-js/angular-signals` provides two things:
3
+ This package exposes two entry points:
4
4
 
5
- - `signalForm`: typed Angular signal-based forms with controls, groups, arrays, validators, warnings, and disabled state.
6
- - signal utilities: helpers for Angular signals, reactive objects, debounced state, reactive `Map`/`Set`, and wrappers for Angular Reactive Forms.
5
+ - `@dvirus-js/angular-signals`: signal utilities and Angular Reactive Forms signal bridges.
6
+ - `@dvirus-js/angular-signals/signal-form`: typed signal-based forms with controls, groups, arrays, validators, warnings, and disabled state.
7
7
 
8
8
  ## Install
9
9
 
@@ -28,7 +28,7 @@ Peer dependencies: `@angular/core`, `@angular/forms`, and `rxjs`.
28
28
  Use `signalForm` to model nested objects and arrays with reactive value, error, warning, touched, dirty, and disabled state.
29
29
 
30
30
  ```ts
31
- import { signalForm, signalFormValidators } from '@dvirus-js/angular-signals';
31
+ import { signalForm, signalFormValidators } from '@dvirus-js/angular-signals/signal-form';
32
32
 
33
33
  const profileForm = signalForm({
34
34
  name: {
@@ -57,18 +57,13 @@ profileForm.controls.age.firstErrorOrWarning();
57
57
  Validators and `disabled` rules can read sibling controls through `getControl`.
58
58
 
59
59
  ```ts
60
- import { signalForm, signalFormValidators } from '@dvirus-js/angular-signals';
60
+ import { signalForm, signalFormValidators } from '@dvirus-js/angular-signals/signal-form';
61
61
 
62
62
  const accountForm = signalForm({
63
63
  role: 'user',
64
64
  adminCode: {
65
65
  value: '',
66
- validators: [
67
- ({ item, getControl }) =>
68
- getControl('role').value() === 'admin' && !item.value
69
- ? { requiredForAdmin: 'Admin code is required' }
70
- : null,
71
- ],
66
+ validators: [({ item, getControl }) => (getControl('role').value() === 'admin' && !item.value ? { requiredForAdmin: 'Admin code is required' } : null)],
72
67
  disabled: ({ getControl }) => getControl('role').value() !== 'admin',
73
68
  },
74
69
  });
@@ -107,20 +102,8 @@ console.log(formSig.controls.firstName.value());
107
102
  These helpers cover debounced state, reactive collections, reactive objects, and signal/value conversion.
108
103
 
109
104
  ```ts
110
- import {
111
- effect,
112
- signal,
113
- } from '@angular/core';
114
- import {
115
- fromSignalObj,
116
- signalDebounce,
117
- signalMap,
118
- signalNotifier,
119
- signalObject,
120
- signalOrValue,
121
- signalSet,
122
- toSignalObj,
123
- } from '@dvirus-js/angular-signals';
105
+ import { effect, signal } from '@angular/core';
106
+ import { fromSignalObj, signalDebounce, signalMap, signalNotifier, signalObject, signalOrValue, signalSet, toSignalObj } from '@dvirus-js/angular-signals';
124
107
 
125
108
  const search = signalDebounce({ debounceTime: 300, initialValue: '' });
126
109
  search.setDebounced('angular');