@signaltree/core 2.0.0 → 2.0.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.
Files changed (2) hide show
  1. package/README.md +19 -17
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -84,7 +84,7 @@ const performance = tree.$.enterprise.divisions.technology.departments.engineeri
84
84
  console.log(`Performance: ${performance}ms`); // ~0.098ms (averaged)
85
85
 
86
86
  // Type-safe updates at unlimited depth
87
- tree.$.enterprise.divisions.technology.departments.engineering.teams.frontend.projects.signaltree.releases.v1.features.recursiveTyping.validation.tests.extreme.depth.set(25); // Perfect type safety!
87
+ tree.$.enterprise.divisions.technology.departments.engineering.teams.frontend.projects.signaltree.releases.v1.features.recursiveTyping.validation.tests.extreme.depth(25); // Perfect type safety!
88
88
  ```
89
89
 
90
90
  ### Basic usage
@@ -103,8 +103,8 @@ console.log(tree.$.count()); // 0
103
103
  console.log(tree.$.message()); // 'Hello World'
104
104
 
105
105
  // Update values
106
- tree.$.count.set(5);
107
- tree.$.message.set('Updated!');
106
+ tree.$.count(5);
107
+ tree.$.message('Updated!');
108
108
 
109
109
  // Use in an Angular component
110
110
  @Component({
@@ -116,7 +116,7 @@ class SimpleComponent {
116
116
  tree = tree;
117
117
 
118
118
  increment() {
119
- this.tree.$.count.update((n) => n + 1);
119
+ this.tree.$.count((n) => n + 1);
120
120
  }
121
121
  }
122
122
  ```
@@ -141,9 +141,9 @@ const tree = signalTree({
141
141
  });
142
142
 
143
143
  // Access nested signals with full type safety
144
- tree.$.user.name.set('Jane Doe');
145
- tree.$.user.preferences.theme.set('light');
146
- tree.$.ui.loading.set(true);
144
+ tree.$.user.name('Jane Doe');
145
+ tree.$.user.preferences.theme('light');
146
+ tree.$.ui.loading(true);
147
147
 
148
148
  // Computed values from nested state
149
149
  const userDisplayName = computed(() => {
@@ -187,33 +187,35 @@ const tree = signalTree<AppState>({
187
187
  auth: {
188
188
  user: null,
189
189
  token: null,
190
- isAuthenticated: false
190
+ isAuthenticated: false,
191
191
  },
192
192
  data: {
193
193
  users: [],
194
194
  posts: [],
195
- cache: {}
195
+ cache: {},
196
196
  },
197
197
  ui: {
198
198
  theme: 'light',
199
199
  sidebar: { open: true, width: 250 },
200
- notifications: []
201
- }
200
+ notifications: [],
201
+ },
202
202
  });
203
203
 
204
204
  // Complex updates with type safety
205
- tree.update(state => ({
205
+ tree((state) => ({
206
206
  auth: {
207
207
  ...state.auth,
208
208
  user: { id: '1', name: 'John' },
209
- isAuthenticated: true
209
+ isAuthenticated: true,
210
210
  },
211
211
  ui: {
212
212
  ...state.ui,
213
- notifications: [
214
- ...state.ui.notifications,
215
- // Get entire state as plain object
216
- const currentState = tree.unwrap();
213
+ notifications: [...state.ui.notifications, { id: '1', message: 'Welcome!', type: 'success' }],
214
+ },
215
+ }));
216
+
217
+ // Get entire state as plain object
218
+ const currentState = tree();
217
219
  console.log('Current app state:', currentState);
218
220
  ```
219
221
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signaltree/core",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Lightweight, type-safe signal-based state management for Angular. Core package providing hierarchical signal trees, basic entity management, and async actions.",
5
5
  "peerDependencies": {
6
6
  "@angular/core": "^20.1.0"