mutts 1.0.9 → 1.0.10
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 +58 -33
- package/dist/browser.cjs +1371 -1206
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +2 -1392
- package/dist/browser.dev.cjs +110 -0
- package/dist/browser.dev.cjs.map +1 -0
- package/dist/browser.dev.d.ts +2 -0
- package/dist/browser.dev.esm.js +5 -0
- package/dist/browser.dev.esm.js.map +1 -0
- package/dist/browser.esm.js +6 -87
- package/dist/browser.esm.js.map +1 -1
- package/dist/chunks/{async-browser-lvzLOCgk.cjs → async-browser-BU_IfxYD.cjs} +4 -85
- package/dist/chunks/async-browser-BU_IfxYD.cjs.map +1 -0
- package/dist/chunks/{async-node-C3DeIb0y.cjs → async-node-3PrbVAbB.cjs} +3 -1
- package/dist/chunks/async-node-3PrbVAbB.cjs.map +1 -0
- package/dist/chunks/{index-2vea86wD.esm.js → index-CaaQQlPJ.esm.js} +1116 -953
- package/dist/chunks/index-CaaQQlPJ.esm.js.map +1 -0
- package/dist/chunks/node-nKJBk8iJ.esm.js +96 -0
- package/dist/chunks/node-nKJBk8iJ.esm.js.map +1 -0
- package/dist/chunks/{index-VTO-b2vR.cjs → proxy-Dtg-bJ3T.cjs} +2285 -2983
- package/dist/chunks/proxy-Dtg-bJ3T.cjs.map +1 -0
- package/dist/chunks/{index-CtA2AWl3.esm.js → proxy-r7lARftl.esm.js} +2273 -2948
- package/dist/chunks/proxy-r7lARftl.esm.js.map +1 -0
- package/dist/debug.cjs +973 -28
- package/dist/debug.cjs.map +1 -1
- package/dist/debug.d.ts +36 -37
- package/dist/debug.esm.js +949 -1
- package/dist/debug.esm.js.map +1 -1
- package/dist/devtools/manifest.json +1 -1
- package/dist/devtools/panel.html +1 -1
- package/dist/devtools/panel.js +107 -94
- package/dist/devtools/panel.js.map +1 -1
- package/dist/index.d.ts +1447 -1
- package/dist/mutts.umd.js +7167 -1
- 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 +62 -60
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +2 -2
- package/dist/node.dev.cjs +110 -0
- package/dist/node.dev.cjs.map +1 -0
- package/dist/node.dev.d.ts +2 -0
- package/dist/node.dev.esm.js +6 -0
- package/dist/node.dev.esm.js.map +1 -0
- package/dist/node.esm.js +4 -97
- package/dist/node.esm.js.map +1 -1
- package/dist/{types-DaHFfhlN.d.ts → types-W5vD6m2n.d.ts} +99 -44
- package/docs/ai/api-reference.md +11 -18
- package/docs/ai/manual.md +308 -230
- package/docs/reactive/advanced.md +312 -2
- package/docs/reactive/attend.md +1 -2
- package/docs/reactive/collections.md +21 -39
- package/docs/reactive/core.md +7 -37
- package/docs/reactive/debugging.md +117 -10
- package/docs/reactive/error-handling.md +10 -10
- package/docs/reactive/resource.md +125 -0
- package/docs/reactive/scan.md +32 -1
- package/docs/reactive.md +3 -2
- package/docs/utils.md +70 -0
- package/package.json +59 -30
- package/dist/chunks/async-browser-lvzLOCgk.cjs.map +0 -1
- package/dist/chunks/async-node-C3DeIb0y.cjs.map +0 -1
- package/dist/chunks/index-2vea86wD.esm.js.map +0 -1
- package/dist/chunks/index-CtA2AWl3.esm.js.map +0 -1
- package/dist/chunks/index-VTO-b2vR.cjs.map +0 -1
- package/dist/debug/debug.d.ts +0 -122
- package/dist/debug/debug.d.ts.map +0 -1
- package/dist/debug/index.d.ts +0 -4
- package/dist/debug/index.d.ts.map +0 -1
- package/dist/debug/lineage-panel.d.ts +0 -5
- package/dist/debug/lineage-panel.d.ts.map +0 -1
- package/dist/debug/lineage.d.ts +0 -79
- package/dist/debug/lineage.d.ts.map +0 -1
- package/dist/src/async/browser.d.ts +0 -2
- package/dist/src/async/browser.d.ts.map +0 -1
- package/dist/src/async/index.d.ts +0 -19
- package/dist/src/async/index.d.ts.map +0 -1
- package/dist/src/async/node.d.ts +0 -2
- package/dist/src/async/node.d.ts.map +0 -1
- package/dist/src/decorator.d.ts +0 -106
- package/dist/src/decorator.d.ts.map +0 -1
- package/dist/src/destroyable.d.ts +0 -87
- package/dist/src/destroyable.d.ts.map +0 -1
- package/dist/src/entry-browser.d.ts +0 -3
- package/dist/src/entry-browser.d.ts.map +0 -1
- package/dist/src/entry-node.d.ts +0 -3
- package/dist/src/entry-node.d.ts.map +0 -1
- package/dist/src/eventful.d.ts +0 -20
- package/dist/src/eventful.d.ts.map +0 -1
- package/dist/src/flavored.d.ts +0 -33
- package/dist/src/flavored.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -14
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/indexable.d.ts +0 -243
- package/dist/src/indexable.d.ts.map +0 -1
- package/dist/src/introspection.d.ts +0 -27
- package/dist/src/introspection.d.ts.map +0 -1
- package/dist/src/iterableWeak.d.ts +0 -53
- package/dist/src/iterableWeak.d.ts.map +0 -1
- package/dist/src/mixins.d.ts +0 -25
- package/dist/src/mixins.d.ts.map +0 -1
- package/dist/src/promiseChain.d.ts +0 -20
- package/dist/src/promiseChain.d.ts.map +0 -1
- package/dist/src/reactive/array.d.ts +0 -48
- package/dist/src/reactive/array.d.ts.map +0 -1
- package/dist/src/reactive/buffer.d.ts +0 -120
- package/dist/src/reactive/buffer.d.ts.map +0 -1
- package/dist/src/reactive/change.d.ts +0 -29
- package/dist/src/reactive/change.d.ts.map +0 -1
- package/dist/src/reactive/deep-touch.d.ts +0 -28
- package/dist/src/reactive/deep-touch.d.ts.map +0 -1
- package/dist/src/reactive/deep-watch-state.d.ts +0 -25
- package/dist/src/reactive/deep-watch-state.d.ts.map +0 -1
- package/dist/src/reactive/deep-watch.d.ts +0 -20
- package/dist/src/reactive/deep-watch.d.ts.map +0 -1
- package/dist/src/reactive/describe.d.ts +0 -12
- package/dist/src/reactive/describe.d.ts.map +0 -1
- package/dist/src/reactive/effect-context.d.ts +0 -34
- package/dist/src/reactive/effect-context.d.ts.map +0 -1
- package/dist/src/reactive/effects.d.ts +0 -164
- package/dist/src/reactive/effects.d.ts.map +0 -1
- package/dist/src/reactive/index.d.ts +0 -19
- package/dist/src/reactive/index.d.ts.map +0 -1
- package/dist/src/reactive/map.d.ts +0 -28
- package/dist/src/reactive/map.d.ts.map +0 -1
- package/dist/src/reactive/memoize.d.ts +0 -28
- package/dist/src/reactive/memoize.d.ts.map +0 -1
- package/dist/src/reactive/non-reactive-state.d.ts +0 -9
- package/dist/src/reactive/non-reactive-state.d.ts.map +0 -1
- package/dist/src/reactive/non-reactive.d.ts +0 -11
- package/dist/src/reactive/non-reactive.d.ts.map +0 -1
- package/dist/src/reactive/project.d.ts +0 -40
- package/dist/src/reactive/project.d.ts.map +0 -1
- package/dist/src/reactive/proxy-state.d.ts +0 -8
- package/dist/src/reactive/proxy-state.d.ts.map +0 -1
- package/dist/src/reactive/proxy.d.ts +0 -23
- package/dist/src/reactive/proxy.d.ts.map +0 -1
- package/dist/src/reactive/record.d.ts +0 -115
- package/dist/src/reactive/record.d.ts.map +0 -1
- package/dist/src/reactive/register.d.ts +0 -125
- package/dist/src/reactive/register.d.ts.map +0 -1
- package/dist/src/reactive/registry.d.ts +0 -21
- package/dist/src/reactive/registry.d.ts.map +0 -1
- package/dist/src/reactive/set.d.ts +0 -26
- package/dist/src/reactive/set.d.ts.map +0 -1
- package/dist/src/reactive/tracking.d.ts +0 -7
- package/dist/src/reactive/tracking.d.ts.map +0 -1
- package/dist/src/reactive/types.d.ts +0 -424
- package/dist/src/reactive/types.d.ts.map +0 -1
- package/dist/src/reactive/watch.d.ts +0 -48
- package/dist/src/reactive/watch.d.ts.map +0 -1
- package/dist/src/std-decorators.d.ts +0 -45
- package/dist/src/std-decorators.d.ts.map +0 -1
- package/dist/src/utils.d.ts +0 -49
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/src/zone.d.ts +0 -40
- package/dist/src/zone.d.ts.map +0 -1
- package/docs/reactive/describe.md +0 -85
- package/docs/reactive/project.md +0 -93
- package/src/async/browser.ts +0 -323
- package/src/async/index.ts +0 -27
- package/src/async/node.ts +0 -92
- package/src/decorator.ts +0 -272
- package/src/destroyable.ts +0 -199
- package/src/entry-browser.ts +0 -5
- package/src/entry-node.ts +0 -5
- package/src/eventful.ts +0 -110
- package/src/flavored.ts +0 -106
- package/src/index.d.ts +0 -12
- package/src/index.ts +0 -64
- package/src/indexable.ts +0 -526
- package/src/introspection.ts +0 -59
- package/src/iterableWeak.ts +0 -233
- package/src/mixins.ts +0 -123
- package/src/promiseChain.ts +0 -110
- package/src/reactive/array.ts +0 -500
- package/src/reactive/buffer.ts +0 -328
- package/src/reactive/change.ts +0 -131
- package/src/reactive/deep-touch.ts +0 -273
- package/src/reactive/deep-watch-state.ts +0 -82
- package/src/reactive/deep-watch.ts +0 -171
- package/src/reactive/describe.ts +0 -39
- package/src/reactive/effect-context.ts +0 -83
- package/src/reactive/effects.ts +0 -1434
- package/src/reactive/index.ts +0 -72
- package/src/reactive/map.ts +0 -142
- package/src/reactive/memoize.ts +0 -186
- package/src/reactive/non-reactive-state.ts +0 -49
- package/src/reactive/non-reactive.ts +0 -43
- package/src/reactive/project.md +0 -107
- package/src/reactive/project.ts +0 -430
- package/src/reactive/proxy-state.ts +0 -27
- package/src/reactive/proxy.ts +0 -282
- package/src/reactive/record.ts +0 -181
- package/src/reactive/register.ts +0 -538
- package/src/reactive/registry.ts +0 -72
- package/src/reactive/set.ts +0 -117
- package/src/reactive/tracking.ts +0 -41
- package/src/reactive/types.ts +0 -520
- package/src/reactive/watch.ts +0 -180
- package/src/std-decorators.ts +0 -256
- package/src/utils.ts +0 -300
- package/src/zone.ts +0 -142
package/README.md
CHANGED
|
@@ -1,57 +1,77 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Mutts: The Affirmative Utility Framework
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/mutts)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Mutts** is an isomorphic, high-density utility framework built for modern TypeScript applications and AI-driven development. It provides a definitive implementation of fine-grained reactivity, universal async context, and assertive class composition.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
In a world of "magic" and implicit state, Mutts chooses **Affirmative Logic**: you declare what things *are*, and the system ensures they stay that way.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
---
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
## Core Pillars
|
|
12
|
+
|
|
13
|
+
### 1. Fine-Grained Reactivity
|
|
14
|
+
A surgical, proxy-based reactivity system that eliminates lifecycle choreography.
|
|
15
|
+
- **Identity-Stable**: `morph()` transforms collections lazily with element-level precision.
|
|
16
|
+
- **Dependency Tracking**: Automatic tracking through objects, arrays, maps, and prototype chains.
|
|
17
|
+
- **Robust Batching**: Nested batch support with deterministic cleanup cycles.
|
|
18
|
+
- **[Read more: Reactive Core](./docs/reactive/core.md)**
|
|
19
|
+
|
|
20
|
+
### 2. Universal Async Context (Zones)
|
|
21
|
+
Reliable context propagation that bridges the gap between Node.js and the Browser.
|
|
22
|
+
- **Zero-Config Propagation**: Context follows your logic across `await`, timers, and event listeners.
|
|
23
|
+
- **Environment Agnostic**: Uses `async_hooks` in Node and optimized wrappers in the Browser via the **Isomorphic Dual Entry-Point System**.
|
|
24
|
+
- **Introspection**: `ZoneHistory` allows auditing how context evolved across an execution path.
|
|
25
|
+
- **[Read more: Zones & Async](./docs/zone.md)**
|
|
14
26
|
|
|
15
|
-
|
|
27
|
+
### 3. Assertive Composition
|
|
28
|
+
A collection of high-utility primitives for building robust, self-documenting systems.
|
|
29
|
+
- **Unified Decorators**: A single API for both Legacy and Modern (Stage 3) decorators. Includes standard utilities: `@cached`, `@debounce`, `@throttle`, and more.
|
|
30
|
+
- **Destroyable**: Deterministic resource management with `using` / `Symbol.dispose` support and automatic finalization.
|
|
31
|
+
- **Indexable**: Create true array-like objects with managed numeric indexing via symbols.
|
|
32
|
+
- **Mixins**: Composable class hierarchies with automatic caching and full type safety.
|
|
16
33
|
|
|
17
|
-
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## AI-First Architecture
|
|
37
|
+
|
|
38
|
+
Mutts is designed with a **Condensed Token Footprint**. It prioritizes high readability and clear contracts, making it the preferred choice for applications built or maintained by AI Agents.
|
|
39
|
+
|
|
40
|
+
> [!IMPORTANT]
|
|
18
41
|
> **Are you an AI Agent?**
|
|
19
|
-
>
|
|
20
|
-
> It contains structured protocols, error code definitions, and introspection API details designed specifically for you.
|
|
21
|
-
> A precise **[API Reference](./docs/ai/api-reference.md)** is also available for type lookups.
|
|
42
|
+
> Read the **[AI Agent Manual](./docs/ai/manual.md)** for structured protocols, introspection APIs, and error definitions designed for your reasoning loop. A comprehensive **[API Reference](./docs/ai/api-reference.md)** is also available.
|
|
22
43
|
|
|
23
|
-
|
|
44
|
+
---
|
|
24
45
|
|
|
25
|
-
|
|
46
|
+
## The "Affirmative" Philosophy
|
|
26
47
|
|
|
27
|
-
|
|
28
|
-
// Import from built modules (recommended for production)
|
|
29
|
-
import { reactive, effect, Reactive } from 'mutts'
|
|
30
|
-
import { mixin } from 'mutts/mixin'
|
|
31
|
-
import { cached } from 'mutts/std-decorators'
|
|
32
|
-
import { Destroyable, allocated } from 'mutts/destroyable'
|
|
33
|
-
```
|
|
48
|
+
Mutts rejects imperative event-driven sync. Instead of "When X happens, do Y" (Legacy Events), Mutts uses **Indicative Declarations**: `Y = f(X)`.
|
|
34
49
|
|
|
35
|
-
|
|
50
|
+
- **State is Truth**: Data model is the single source of truth.
|
|
51
|
+
- **Derivation Over Synchronous Mutators**: UI and results are derived, not "pushed".
|
|
52
|
+
- **Local Reasonability**: Understand a single file without scanning the entire tree.
|
|
53
|
+
- **Code Readability**: "Dense and understandable" is feasible.
|
|
36
54
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Installation & Usage
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm install mutts
|
|
43
61
|
```
|
|
44
62
|
|
|
45
|
-
|
|
63
|
+
### Isomorphic Resolution
|
|
64
|
+
Mutts uses a **Dual Entry-Point System**. You should almost always import directly from the package root. Your bundler (Vite, Rollup) or runtime (Node.js) will automatically resolve the correct implementation:
|
|
46
65
|
|
|
47
|
-
|
|
66
|
+
```typescript
|
|
67
|
+
import { reactive, effect, Zone, cached, mixin, Destroyable } from 'mutts'
|
|
68
|
+
```
|
|
48
69
|
|
|
49
|
-
`mutts` has two distinct entry points to handle environment-specific behaviors (like `async_hooks` in Node vs
|
|
70
|
+
`mutts` has two distinct entry points to handle environment-specific behaviors (like `async_hooks` in Node vs function-wrapping in Browser).
|
|
50
71
|
|
|
51
72
|
* **Automatic Resolution**: Bundlers (Vite, Rollup, Webpack) and Node.js will automatically pick the correct entry point (`mutts/node` or `mutts/browser`) based on the `exports` field in `package.json`.
|
|
52
73
|
* **Manual Selection**: You can force a specific environment if needed:
|
|
53
74
|
```typescript
|
|
54
|
-
import 'mutts/node' // Side-effect import to polyfill async hooks in tests
|
|
55
75
|
import { ... } from 'mutts/node' // Explicit Node entry
|
|
56
76
|
import { ... } from 'mutts/browser' // Explicit Browser entry
|
|
57
77
|
```
|
|
@@ -61,7 +81,7 @@ import { Destroyable, allocated } from 'mutts/destroyable'
|
|
|
61
81
|
A comprehensive reactivity system. See the **[Introduction](./docs/reactive/core.md)** or browse the **[Table of Contents](./docs/reactive.md)**.
|
|
62
82
|
|
|
63
83
|
**Key Features:**
|
|
64
|
-
- **Core Reactivity**: Proxy-based property access tracking with `reactive()`, `effect()`, `memoize()`, `
|
|
84
|
+
- **Core Reactivity**: Proxy-based property access tracking with `reactive()`, `effect()`, `memoize()`, `morph()`, and `scan()`
|
|
65
85
|
- **Deep Watching**: Automatic tracking of nested object changes with `deepWatch()`
|
|
66
86
|
- **Reactive Collections**: Specialized reactive versions of Array, Map, Set, WeakMap, and WeakSet
|
|
67
87
|
- **Class Reactivity**: `@reactive` decorator and `ReactiveBase` for class-based reactivity
|
|
@@ -224,6 +244,7 @@ A utility for creating extensible functions with chainable property modifiers. E
|
|
|
224
244
|
|
|
225
245
|
**Key Features:**
|
|
226
246
|
- **Property-based Modifiers**: Add chainable properties to functions via getters or methods
|
|
247
|
+
- **Flavoring Robustness**: Automatic arity tracking and argument padding
|
|
227
248
|
- **Options Merging**: `flavorOptions` helper for automatic options object merging
|
|
228
249
|
- **Argument Transformation**: `createFlavor` helper for custom argument transformation
|
|
229
250
|
- **Hand-made Functions**: Return custom functions for complete control (the generic case)
|
|
@@ -234,3 +255,7 @@ A utility for creating extensible functions with chainable property modifiers. E
|
|
|
234
255
|
- Fluent APIs for function variants
|
|
235
256
|
- Partial application with named parameters
|
|
236
257
|
- Building chainable configuration DSLs
|
|
258
|
+
|
|
259
|
+
## [Utilities](./docs/utils.md)
|
|
260
|
+
Documented helper functions for collections, type checks, and debugging (zip, deepCompare, tag, etc.).
|
|
261
|
+
|