mutts 1.0.13 → 1.0.15
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/BROWSER_ASYNC_POLYFILL.md +79 -0
- package/README.md +2 -2
- package/dist/browser.cjs +216 -97
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +42 -9
- package/dist/browser.dev.cjs +81 -71
- package/dist/browser.dev.cjs.map +1 -1
- package/dist/browser.dev.d.ts +2 -2
- package/dist/browser.dev.esm.js +2 -2
- package/dist/browser.esm.js +137 -28
- package/dist/browser.esm.js.map +1 -1
- package/dist/chunks/{proxy-BtmPFjSr.esm.js → effects-CPjf6gNA.esm.js} +2605 -2155
- package/dist/chunks/effects-CPjf6gNA.esm.js.map +1 -0
- package/dist/chunks/{proxy-DBHj3kGK.cjs → effects-oUauWxxl.cjs} +2615 -2156
- package/dist/chunks/effects-oUauWxxl.cjs.map +1 -0
- package/dist/chunks/{index-CAdnMJev.cjs → index-Dtj2qZ0d.cjs} +418 -350
- package/dist/chunks/index-Dtj2qZ0d.cjs.map +1 -0
- package/dist/chunks/{index-XsYTUhHx.esm.js → index-YGpb1te7.esm.js} +156 -88
- package/dist/chunks/index-YGpb1te7.esm.js.map +1 -0
- package/dist/chunks/node-CKuro-Uk.cjs +187 -0
- package/dist/chunks/node-CKuro-Uk.cjs.map +1 -0
- package/dist/chunks/node-sQtns7M-.esm.js +185 -0
- package/dist/chunks/node-sQtns7M-.esm.js.map +1 -0
- package/dist/debug.cjs +76 -49
- package/dist/debug.cjs.map +1 -1
- package/dist/debug.esm.js +37 -10
- package/dist/debug.esm.js.map +1 -1
- package/dist/mutts.umd.js +4169 -3532
- package/dist/mutts.umd.js.map +1 -1
- package/dist/mutts.umd.min.js +1 -1
- package/dist/mutts.umd.min.js.map +1 -1
- package/dist/node.cjs +82 -72
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +2 -2
- package/dist/node.dev.cjs +82 -72
- package/dist/node.dev.cjs.map +1 -1
- package/dist/node.dev.d.ts +2 -2
- package/dist/node.dev.esm.js +3 -3
- package/dist/node.esm.js +3 -3
- package/dist/types.d.ts +30 -15
- package/docs/ai/api-reference.md +3 -1
- package/docs/ai/manual.md +17 -5
- package/docs/reactive/advanced.md +169 -10
- package/docs/reactive/debugging.md +15 -13
- package/docs/reactive.md +2 -1
- package/package.json +12 -7
- package/dist/chunks/index-CAdnMJev.cjs.map +0 -1
- package/dist/chunks/index-XsYTUhHx.esm.js.map +0 -1
- package/dist/chunks/node-DrrphEPf.cjs +0 -98
- package/dist/chunks/node-DrrphEPf.cjs.map +0 -1
- package/dist/chunks/node-NEZvVo4M.esm.js +0 -96
- package/dist/chunks/node-NEZvVo4M.esm.js.map +0 -1
- package/dist/chunks/proxy-BtmPFjSr.esm.js.map +0 -1
- package/dist/chunks/proxy-DBHj3kGK.cjs.map +0 -1
|
@@ -45,7 +45,7 @@ The wrapped function preserves its signature (parameters and return value), and
|
|
|
45
45
|
|
|
46
46
|
### `atom()` - Immediate Atomic Execution
|
|
47
47
|
|
|
48
|
-
While `atomic()` **wraps** a function for later calls, `atom()` **runs** a function immediately and atomically. It
|
|
48
|
+
While `atomic()` **wraps** a function for later calls, `atom()` **runs** a function immediately and atomically. It uses `batch(fn, { immediate: true })`, so it executes right away even inside an existing batch while still contributing its triggered effects to the active transaction.
|
|
49
49
|
|
|
50
50
|
```typescript
|
|
51
51
|
import { atom, reactive, effect } from 'mutts'
|
|
@@ -80,6 +80,122 @@ const update = atomic((a, b) => { state.a = a; state.b = b })
|
|
|
80
80
|
update(1, 2) // runs when called
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
+
### `batch()` - Explicit Batch Control
|
|
84
|
+
|
|
85
|
+
`batch()` now uses an options object:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
batch(effectOrEffects, {
|
|
89
|
+
immediate?: boolean,
|
|
90
|
+
contained?: boolean,
|
|
91
|
+
caller?: EffectTrigger,
|
|
92
|
+
})
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The main modes are:
|
|
96
|
+
|
|
97
|
+
- default nested behavior: if a batch is already active, `batch(fn)` joins that existing batch instead of creating an implicit child batch
|
|
98
|
+
- `immediate: true`: execute the provided function now, but keep all triggered effects inside the current batch
|
|
99
|
+
- `contained: true`: force a fresh local batch that drains before returning, even when called from inside another batch
|
|
100
|
+
- `caller`: advanced internal override for causal chaining; most user code should omit it
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { batch, effect, reactive } from 'mutts'
|
|
104
|
+
|
|
105
|
+
const state = reactive({ a: 0, b: 0 })
|
|
106
|
+
|
|
107
|
+
effect(() => {
|
|
108
|
+
console.log(state.a, state.b)
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
batch(() => {
|
|
112
|
+
state.a = 1
|
|
113
|
+
state.b = 2
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
batch(() => {
|
|
117
|
+
state.a = 3
|
|
118
|
+
}, { immediate: true })
|
|
119
|
+
|
|
120
|
+
batch(() => {
|
|
121
|
+
state.b = 4
|
|
122
|
+
}, { immediate: true, contained: true })
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### Nested semantics
|
|
126
|
+
|
|
127
|
+
Nested batching is no longer implicitly contained.
|
|
128
|
+
|
|
129
|
+
- `batch(fn)` inside another batch joins the parent batch
|
|
130
|
+
- `batch(fn, { immediate: true })` runs `fn` now and queues its consequences into the parent batch
|
|
131
|
+
- `batch(fn, { contained: true })` creates an isolated sub-batch and flushes it before returning
|
|
132
|
+
|
|
133
|
+
Use `contained: true` only when you explicitly need sub-transaction behavior.
|
|
134
|
+
|
|
135
|
+
### Effect Ordering with Phase Tokens
|
|
136
|
+
|
|
137
|
+
Effects are usually ordered by their data dependencies: an effect that reads a reactive property is eligible to re-run after another effect changes that property. Mutts uses those causal links as an execution graph by default. The `reactiveOptions.scheduler` option controls how much of that graph is maintained for scheduling and diagnostics:
|
|
138
|
+
|
|
139
|
+
- `scheduler: 'ordered'` (default): effects that are already queued together are processed in dependency order when possible, so consequences run after the effects that caused them. Parent effects also run before their queued child effects, which lets parent cleanup stop stale children before they re-run.
|
|
140
|
+
- `scheduler: 'debug'`: ordered scheduling plus heavier diagnostics for investigation.
|
|
141
|
+
- `scheduler: 'raw'`: graph maintenance is disabled for speed, and already-queued effects use FIFO ordering with heuristic cycle protection.
|
|
142
|
+
|
|
143
|
+
When you need to make a render phase or other side-effect phase explicit, use an ordinary reactive "phase token": one effect advances the token, and later effects read it.
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
import { effect, reactive } from 'mutts'
|
|
147
|
+
|
|
148
|
+
const phase = reactive({
|
|
149
|
+
measured: 0,
|
|
150
|
+
positioned: 0,
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
effect`render:measure`(() => {
|
|
154
|
+
measureDom()
|
|
155
|
+
phase.measured++
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
effect`render:position`(() => {
|
|
159
|
+
phase.measured
|
|
160
|
+
positionDom()
|
|
161
|
+
phase.positioned++
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
effect`render:paint`(() => {
|
|
165
|
+
phase.positioned
|
|
166
|
+
paintDom()
|
|
167
|
+
})
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
This is sometimes called a beacon, barrier, or phase marker in application code, but it does not need a special primitive: the token is just reactive state. The important part is that the dependency is visible. The second effect does not merely rely on incidental registration order; it declares "I am downstream of `phase.measured`."
|
|
171
|
+
|
|
172
|
+
This phase-token pattern also works in `scheduler: 'raw'` when the token is the downstream effect's actual scheduling dependency: the producer runs, advances the token, and that write queues the consumer afterward. That ordering comes from normal queuing, not from the dependency graph. What raw mode does not do is topologically reorder two effects that were already queued independently by some other write.
|
|
173
|
+
|
|
174
|
+
If the downstream effect should be scheduled only by the phase token, and not directly by the raw state used by the producer, read the raw payload untracked:
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
import { effect, reactive, untracked } from 'mutts'
|
|
178
|
+
|
|
179
|
+
const state = reactive({ input: '' })
|
|
180
|
+
const phase = reactive({ rendered: 0 })
|
|
181
|
+
|
|
182
|
+
effect`render:first-pass`(() => {
|
|
183
|
+
state.input
|
|
184
|
+
renderFirstPass()
|
|
185
|
+
phase.rendered++
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
effect`render:second-pass`(() => {
|
|
189
|
+
phase.rendered
|
|
190
|
+
|
|
191
|
+
untracked`render:second-pass:payload`(() => {
|
|
192
|
+
renderSecondPass(state.input)
|
|
193
|
+
})
|
|
194
|
+
})
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Use `defer()` instead when the desired ordering is "after the whole current batch has settled" rather than "after this producer effect advances this phase."
|
|
198
|
+
|
|
83
199
|
### `addBatchCleanup()` / `defer()` - Deferring Work to Avoid Cycles
|
|
84
200
|
|
|
85
201
|
When an effect needs to perform an action that would modify state the effect depends on, this can create a reactive cycle. The `addBatchCleanup` function (also exported as `defer` for semantic clarity) allows you to defer such work until after the current batch of effects completes.
|
|
@@ -238,7 +354,7 @@ addBatchCleanup(() => {
|
|
|
238
354
|
|
|
239
355
|
**Nested Batches:**
|
|
240
356
|
|
|
241
|
-
Callbacks added in nested batches are collected and run when the **outermost batch** completes:
|
|
357
|
+
Callbacks added in inherited nested batches are collected and run when the **outermost batch** completes:
|
|
242
358
|
|
|
243
359
|
```typescript
|
|
244
360
|
effect(() => {
|
|
@@ -252,7 +368,15 @@ effect(() => {
|
|
|
252
368
|
// Output:
|
|
253
369
|
// Outer deferred
|
|
254
370
|
// Inner deferred
|
|
255
|
-
// (Both run after outer batch completes)
|
|
371
|
+
// (Both run after outer batch completes because `atomic()` joins the active batch)
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
If you need deferred callbacks to flush within an isolated nested batch, use an explicitly contained batch:
|
|
375
|
+
|
|
376
|
+
```typescript
|
|
377
|
+
batch(() => {
|
|
378
|
+
addBatchCleanup(() => console.log('Contained deferred'))
|
|
379
|
+
}, { contained: true })
|
|
256
380
|
```
|
|
257
381
|
|
|
258
382
|
**Error Handling:**
|
|
@@ -935,7 +1059,7 @@ When you replace a reactive object with another object that shares the same prot
|
|
|
935
1059
|
|
|
936
1060
|
- Watchers attached to the container are *not* re-fired if the container's prototype did not change (this avoids unnecessary parent effect re-runs).
|
|
937
1061
|
- Watchers attached to nested properties are re-evaluated only for keys that actually changed (added, removed, or whose values differ).
|
|
938
|
-
- For arrays, the
|
|
1062
|
+
- For arrays, the behavior stays index-oriented: replacing an element at index `i` fires a touch for that index (and `length` if needed) rather than diffing the element recursively. This preserves reorder detection.
|
|
939
1063
|
- Prototype chain properties are compared when both objects have prototype chains, ensuring changes to prototype-level properties are detected.
|
|
940
1064
|
|
|
941
1065
|
**Integration with Prototype Chains:**
|
|
@@ -981,7 +1105,7 @@ expect(titleWatcher).toHaveBeenCalledTimes(2)
|
|
|
981
1105
|
expect(viewsWatcher).toHaveBeenCalledTimes(2)
|
|
982
1106
|
```
|
|
983
1107
|
|
|
984
|
-
This
|
|
1108
|
+
This behavior keeps container-level watchers stable while still delivering fine-grained updates to nested effects—ideal when you replace data structures with freshly fetched objects that share the same prototype.
|
|
985
1109
|
|
|
986
1110
|
### Origin Filtering
|
|
987
1111
|
|
|
@@ -1243,17 +1367,36 @@ state.items = fetchedItems // deep touch diffs old vs new per-index — no lift
|
|
|
1243
1367
|
```typescript
|
|
1244
1368
|
import { morph } from 'mutts'
|
|
1245
1369
|
|
|
1370
|
+
// Arrays: (item, position, access?) => O
|
|
1246
1371
|
function morph<I, O>(
|
|
1247
1372
|
source: readonly I[] | (() => readonly I[]),
|
|
1248
|
-
fn: (arg: I) => O,
|
|
1373
|
+
fn: (arg: I, position: { index: number }, access?: EffectAccess) => O,
|
|
1249
1374
|
options?: { pure?: boolean | ((i: I) => boolean) }
|
|
1250
1375
|
): O[]
|
|
1376
|
+
|
|
1377
|
+
// Maps: (value, key, access?) => O
|
|
1378
|
+
function morph<K, V, O>(
|
|
1379
|
+
source: Map<K, V>,
|
|
1380
|
+
fn: (arg: V, key: K, access?: EffectAccess) => O,
|
|
1381
|
+
options?: { pure?: boolean | ((i: V) => boolean) }
|
|
1382
|
+
): Map<K, O>
|
|
1383
|
+
|
|
1384
|
+
// Records: (value, key, access?) => O
|
|
1385
|
+
function morph<S extends Record<PropertyKey, any>, O>(
|
|
1386
|
+
source: S,
|
|
1387
|
+
fn: (arg: S[keyof S], key: keyof S, access?: EffectAccess) => O,
|
|
1388
|
+
options?: { pure?: boolean | ((i: S[keyof S]) => boolean) }
|
|
1389
|
+
): { [K in keyof S]: O }
|
|
1251
1390
|
```
|
|
1252
1391
|
|
|
1253
1392
|
**Parameters**
|
|
1254
1393
|
|
|
1255
|
-
- `source`: a reactive array or a function returning one. Array mutations are tracked via `arrayDiff`.
|
|
1256
|
-
- `fn`: mapping callback.
|
|
1394
|
+
- `source`: a reactive array, Map, or record, or a function returning one. Array mutations are tracked via `arrayDiff`.
|
|
1395
|
+
- `fn`: mapping callback. Signature varies by source type:
|
|
1396
|
+
- Arrays: `(item, position, access?) => O` where `position.index` is the current index
|
|
1397
|
+
- Maps: `(value, key, access?) => O`
|
|
1398
|
+
- Records: `(value, key, access?) => O`
|
|
1399
|
+
In the default (non-pure) mode, each element's computation runs inside its own effect, so reactive reads inside `fn` are tracked and will invalidate that element's cache when they change.
|
|
1257
1400
|
- `options.pure`: controls per-item effect creation. `true` skips effects for all items (same as `morph.pure`). A **predicate function** `(i: I) => boolean` decides per-item: return `true` to skip the effect (pure), `false` to create one (reactive). The predicate receives the input item and is evaluated once per cache slot on first access.
|
|
1258
1401
|
|
|
1259
1402
|
**Behaviour**
|
|
@@ -1261,6 +1404,7 @@ function morph<I, O>(
|
|
|
1261
1404
|
- **Lazy**: elements are only computed when accessed (e.g. `result[0]`). Unaccessed indices remain `undefined` in the cache.
|
|
1262
1405
|
- **Identity stable**: the returned reactive array proxy is the same object across source mutations. Only affected indices are invalidated.
|
|
1263
1406
|
- **Per-item effects** (default): each accessed element gets its own effect. If `fn` reads reactive values beyond its argument, changes to those values invalidate and recompute only the affected elements.
|
|
1407
|
+
- **Reactive position**: For arrays, the `position` object is stable per item and its `index` updates reactively when items move due to shifts/reorders.
|
|
1264
1408
|
- **Cleanup**: the returned array is `cleanedBy` the internal morph effect. When the parent effect is disposed, the morph effect and all per-item effects are cleaned up.
|
|
1265
1409
|
|
|
1266
1410
|
**Basic usage**
|
|
@@ -1281,6 +1425,21 @@ console.log(upper[3]) // "DAVE"
|
|
|
1281
1425
|
items.splice(1, 1) // Remove 'bob' — indices shift, cache invalidated for affected positions
|
|
1282
1426
|
```
|
|
1283
1427
|
|
|
1428
|
+
**Using position.index**
|
|
1429
|
+
|
|
1430
|
+
```typescript
|
|
1431
|
+
const items = reactive(['a', 'b', 'c'])
|
|
1432
|
+
const indexed = morph(items, (item, position) => `${item}@${position.index}`)
|
|
1433
|
+
|
|
1434
|
+
console.log(indexed[0]) // "a@0"
|
|
1435
|
+
console.log(indexed[1]) // "b@1"
|
|
1436
|
+
|
|
1437
|
+
items.unshift('x') // Insert at beginning
|
|
1438
|
+
console.log(indexed[0]) // "x@0"
|
|
1439
|
+
console.log(indexed[1]) // "a@1" — position.index updated reactively
|
|
1440
|
+
console.log(indexed[2]) // "b@2"
|
|
1441
|
+
```
|
|
1442
|
+
|
|
1284
1443
|
**With reactive callback dependencies**
|
|
1285
1444
|
|
|
1286
1445
|
```typescript
|
|
@@ -1491,7 +1650,7 @@ For a full guide on debugging, including cycle detection and memoization discrep
|
|
|
1491
1650
|
|
|
1492
1651
|
### Quick Summary
|
|
1493
1652
|
|
|
1494
|
-
- **Cycle Detection**: Automatically catch circular dependencies via `reactiveOptions.
|
|
1495
|
-
- **
|
|
1653
|
+
- **Cycle Detection**: Automatically catch circular dependencies via `reactiveOptions.scheduler`. Note: Instant mathematical detection requires choosing `'ordered'` or `'debug'` mode.
|
|
1654
|
+
- **Ordered Mode**: The default `reactiveOptions.scheduler` is set to `'ordered'`, preserving causal ordering and parent/child effect lifecycle ordering.
|
|
1496
1655
|
- **Memoization Discrepancy**: Detect "missing dependencies" by running computations twice during development using `reactiveOptions.onMemoizationDiscrepancy`.
|
|
1497
1656
|
- **Global Hooks**: Use `reactiveOptions.touched`, `enter`, and `leave` to observe system activity.
|
|
@@ -25,7 +25,7 @@ These hooks are called during the execution of effects and computed values.
|
|
|
25
25
|
|
|
26
26
|
- **`beginChain(targets: Function[]) / endChain()`**: Called when a batch of effects starts and ends its execution.
|
|
27
27
|
- **`maxEffectChain`**: (Default: `100`) Limits the depth of synchronous effect triggering to prevent stack overflows.
|
|
28
|
-
- **`maxTriggerPerBatch`**: (Default: `10`) Limits how many times a single effect can be triggered within the same batch. Useful for detecting aggressive re-computation or infinite cycles in `
|
|
28
|
+
- **`maxTriggerPerBatch`**: (Default: `10`) Limits how many times a single effect can be triggered within the same batch. Useful for detecting aggressive re-computation or infinite cycles, especially in `scheduler: 'raw'` mode.
|
|
29
29
|
|
|
30
30
|
## Cycle Detection
|
|
31
31
|
|
|
@@ -33,25 +33,27 @@ These hooks are called during the execution of effects and computed values.
|
|
|
33
33
|
|
|
34
34
|
### Configuration
|
|
35
35
|
|
|
36
|
-
You can control how cycles are handled via `reactiveOptions.
|
|
36
|
+
You can control how cycles are handled via `reactiveOptions.scheduler`:
|
|
37
37
|
|
|
38
|
-
- **`'
|
|
39
|
-
- **`'
|
|
40
|
-
- **`'debug'`**:
|
|
38
|
+
- **`'ordered'`** (Default): Maintains the causal effect graph for dependency ordering, parent/child lifecycle ordering, and early cycle detection. Throws immediately with basic path information.
|
|
39
|
+
- **`'raw'`**: High-performance FIFO mode. Disables the dependency graph and topological sorting. Uses heuristic detection via `maxEffectChain`.
|
|
40
|
+
- **`'debug'`**: Ordered scheduling plus the heaviest diagnostics. Provides detailed cycle path reporting.
|
|
41
|
+
|
|
42
|
+
`reactiveOptions.cycleHandling` is still accepted as a deprecated alias: `'production'` maps to `'raw'`, and `'development'` maps to `'ordered'`.
|
|
41
43
|
|
|
42
44
|
### Topological vs. Flat Mode Detection
|
|
43
45
|
- **Detection**: Cycles are detected when the execution depth exceeds `maxEffectChain` (default 100).
|
|
44
46
|
- **Diagnostics**: The resulting `ReactiveError` includes a `trace` property (the recent execution sequence) and attempts to identify a repeating `cycle`.
|
|
45
|
-
- **Recommendation**: Use
|
|
47
|
+
- **Recommendation**: Use `raw` only when FIFO scheduling is sufficient and you want minimum overhead.
|
|
46
48
|
|
|
47
49
|
### Cycle Handling Modes
|
|
48
50
|
|
|
49
|
-
You can configure how the system handles cycles via `reactiveOptions.
|
|
51
|
+
You can configure how the system handles cycles via `reactiveOptions.scheduler`:
|
|
50
52
|
|
|
51
53
|
| Mode | Detection Timing | Cycle Information | Performance |
|
|
52
54
|
|------|-----------------|-------------------|-------------|
|
|
53
|
-
| `'
|
|
54
|
-
| `'
|
|
55
|
+
| `'ordered'` | Eager (On edge) | Exact path (DFS) | Moderate |
|
|
56
|
+
| `'raw'` | Late (Heuristic) | Trace of last N effects | Fastest |
|
|
55
57
|
| `'debug'` | Structural | Transitive closures | Slowest |
|
|
56
58
|
|
|
57
59
|
#### Finding Cycle Information
|
|
@@ -71,7 +73,7 @@ try {
|
|
|
71
73
|
|
|
72
74
|
- **`error.cycle`**: An array of effect names forming the cycle.
|
|
73
75
|
- **`error.causalChain`**: The sequence of triggers that led to the current effect.
|
|
74
|
-
- **`error.lineage`**: The creation stack of the effect (available in `
|
|
76
|
+
- **`error.lineage`**: The creation stack of the effect (available in `ordered` or `debug` modes).
|
|
75
77
|
|
|
76
78
|
### Memoization Discrepancy Detection
|
|
77
79
|
|
|
@@ -190,13 +192,13 @@ Since these are runtime options, you can toggle them based on your environment:
|
|
|
190
192
|
|
|
191
193
|
```typescript
|
|
192
194
|
if (process.env.NODE_ENV === 'development') {
|
|
193
|
-
reactiveOptions.
|
|
195
|
+
reactiveOptions.scheduler = 'debug';
|
|
194
196
|
reactiveOptions.onMemoizationDiscrepancy = myHandler;
|
|
195
197
|
enableIntrospection();
|
|
196
198
|
} else {
|
|
197
|
-
//
|
|
199
|
+
// Keep heavy diagnostics off in production for performance
|
|
198
200
|
reactiveOptions.onMemoizationDiscrepancy = undefined;
|
|
199
|
-
reactiveOptions.
|
|
201
|
+
reactiveOptions.scheduler = 'ordered'; // or 'raw' when FIFO scheduling is enough
|
|
200
202
|
}
|
|
201
203
|
```
|
|
202
204
|
|
package/docs/reactive.md
CHANGED
|
@@ -19,6 +19,7 @@ The Mutts Reactive System documentation has been split into focused sections for
|
|
|
19
19
|
## [Advanced Topics](./reactive/advanced.md)
|
|
20
20
|
* **[Choosing the Right Primitive](./reactive/advanced.md#choosing-the-right-reactive-primitive)**: Comparison table of effect-value functions (memoize, lift, project, etc.)
|
|
21
21
|
* **[Atomic Operations](./reactive/advanced.md#atomic-operations)**: Batching and Bidirectional binding
|
|
22
|
+
* **[Effect Ordering](./reactive/advanced.md#effect-ordering-with-phase-tokens)**: Use reactive phase tokens to make dependency ordering explicit
|
|
22
23
|
* **[Evolution Tracking](./reactive/advanced.md#evolution-tracking)**: History introspection
|
|
23
24
|
* **[Prototype Chains](./reactive/advanced.md#prototype-chains-and-pure-objects)**: Advanced inheritance patterns
|
|
24
25
|
* **[Memoization](./reactive/advanced.md#memoization)**: Caching strategies
|
|
@@ -30,4 +31,4 @@ The Mutts Reactive System documentation has been split into focused sections for
|
|
|
30
31
|
* **[Memoization Discrepancy](./reactive/debugging.md#memoization-discrepancy-detection)**: Identifying missing dependencies
|
|
31
32
|
* **[Introspection API](./reactive/debugging.md#introspection-api)**: Programmatic analysis and dependency graphs
|
|
32
33
|
|
|
33
|
-
* **[Performance](./reactive/debugging.md#performance-cost)**: Understanding the cost of debugging tools
|
|
34
|
+
* **[Performance](./reactive/debugging.md#performance-cost)**: Understanding the cost of debugging tools
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mutts",
|
|
3
3
|
"description": "Modern UTility TS: A collection of TypeScript utilities",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.15",
|
|
5
5
|
"main": "dist/browser.cjs",
|
|
6
6
|
"module": "dist/browser.esm.js",
|
|
7
7
|
"exports": {
|
|
@@ -90,7 +90,8 @@
|
|
|
90
90
|
"files": [
|
|
91
91
|
"dist",
|
|
92
92
|
"README.md",
|
|
93
|
-
"docs"
|
|
93
|
+
"docs",
|
|
94
|
+
"BROWSER_ASYNC_POLYFILL.md"
|
|
94
95
|
],
|
|
95
96
|
"scripts": {
|
|
96
97
|
"build:js": "rollup -c",
|
|
@@ -142,6 +143,8 @@
|
|
|
142
143
|
"./src/entry-browser.dev.ts",
|
|
143
144
|
"./src/entry-node.ts",
|
|
144
145
|
"./src/entry-node.dev.ts",
|
|
146
|
+
"./debug/index.ts",
|
|
147
|
+
"./debug/debug.ts",
|
|
145
148
|
"./dist/browser.esm.js",
|
|
146
149
|
"./dist/browser.dev.esm.js",
|
|
147
150
|
"./dist/browser.cjs",
|
|
@@ -149,7 +152,9 @@
|
|
|
149
152
|
"./dist/node.esm.js",
|
|
150
153
|
"./dist/node.dev.esm.js",
|
|
151
154
|
"./dist/node.cjs",
|
|
152
|
-
"./dist/node.dev.cjs"
|
|
155
|
+
"./dist/node.dev.cjs",
|
|
156
|
+
"./dist/debug.esm.js",
|
|
157
|
+
"./dist/debug.cjs"
|
|
153
158
|
],
|
|
154
159
|
"engines": {
|
|
155
160
|
"node": ">=16.0.0"
|
|
@@ -162,8 +167,8 @@
|
|
|
162
167
|
"@rollup/plugin-terser": "^1.0.0",
|
|
163
168
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
164
169
|
"@types/node": "^22.10.10",
|
|
165
|
-
"@vitest/browser": "^4.
|
|
166
|
-
"@vitest/browser-playwright": "^4.
|
|
170
|
+
"@vitest/browser": "^4.1.4",
|
|
171
|
+
"@vitest/browser-playwright": "^4.1.4",
|
|
167
172
|
"playwright": "^1.58.1",
|
|
168
173
|
"rollup": "^4.52.2",
|
|
169
174
|
"rollup-plugin-copy": "^3.5.0",
|
|
@@ -174,7 +179,7 @@
|
|
|
174
179
|
"tsx": "^4.20.4",
|
|
175
180
|
"typescript": "^5.8.3",
|
|
176
181
|
"vis-network": "^9.1.9",
|
|
177
|
-
"vitest": "^4.
|
|
182
|
+
"vitest": "^4.1.4"
|
|
178
183
|
},
|
|
179
184
|
"packageManager": "pnpm@10.7.1+sha512.2d92c86b7928dc8284f53494fb4201f983da65f0fb4f0d40baafa5cf628fa31dae3e5968f12466f17df7e97310e30f343a648baea1b9b350685dafafffdf5808"
|
|
180
|
-
}
|
|
185
|
+
}
|