@jucie.io/state 1.0.36 → 1.0.38

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.
@@ -217,13 +217,13 @@ const state = createState({
217
217
 
218
218
  // Install with custom configuration
219
219
  state.install(HistoryManager.configure({
220
- maxSize: 200 // Limit to 200 history items (default: 100)
220
+ maxSize: 200 // Keep up to 200 undo steps (default: 100)
221
221
  }));
222
222
  ```
223
223
 
224
224
  ### Options
225
225
 
226
- - **`maxSize`** (number): Maximum number of history items to keep. Default: `100`
226
+ - **`maxSize`** (number): Maximum number of undo steps to keep. A step is one commit, however many changes it holds; the oldest step is dropped whole. Default: `100`
227
227
 
228
228
  ## Advanced Usage
229
229
 
@@ -243,15 +243,17 @@ state.history.commit();
243
243
  // All changes are now a single undo step with a descriptive marker
244
244
  ```
245
245
 
246
- ### Pause and Resume Recording
246
+ ### Untracked Writes
247
247
 
248
- ```javascript
249
- // Temporarily pause history recording (internal API)
250
- state.plugins.history.pause();
251
-
252
- state.set(['temp', 'data'], 'not recorded');
248
+ Writes inside `untracked` stay in state but never become an undo step — for
249
+ shared data (comments, presence) that one user's undo must not take back. The
250
+ callback must be synchronous: writes after an `await` are recorded. It returns
251
+ what the callback returns.
253
252
 
254
- state.plugins.history.resume();
253
+ ```javascript
254
+ state.history.untracked(() => {
255
+ state.set(['comments', 'c1'], { text: 'not recorded' });
256
+ });
255
257
 
256
258
  state.set(['tracked', 'data'], 'recorded'); // This will be recorded
257
259
  ```