mutts 1.0.8 → 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 +77 -35
- package/dist/browser.cjs +2144 -5355
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +2 -1655
- 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 +20 -107
- package/dist/browser.esm.js.map +1 -1
- package/dist/chunks/{async-browser-CA0jPWIi.cjs → async-browser-BU_IfxYD.cjs} +19 -107
- package/dist/chunks/async-browser-BU_IfxYD.cjs.map +1 -0
- package/dist/chunks/{async-core-UqHzvJ-S.cjs → async-core-CRLKP3l-.cjs} +8 -4
- package/dist/chunks/async-core-CRLKP3l-.cjs.map +1 -0
- package/dist/chunks/{async-node-BYHuGTni.cjs → async-node-3PrbVAbB.cjs} +7 -12
- package/dist/chunks/async-node-3PrbVAbB.cjs.map +1 -0
- package/dist/chunks/index-CaaQQlPJ.esm.js +3174 -0
- 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/proxy-Dtg-bJ3T.cjs +3763 -0
- package/dist/chunks/proxy-Dtg-bJ3T.cjs.map +1 -0
- package/dist/chunks/proxy-r7lARftl.esm.js +3701 -0
- package/dist/chunks/proxy-r7lARftl.esm.js.map +1 -0
- package/dist/debug.cjs +980 -0
- package/dist/debug.cjs.map +1 -0
- package/dist/debug.d.ts +208 -0
- package/dist/debug.esm.js +950 -0
- package/dist/debug.esm.js.map +1 -0
- 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 -13
- 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 +70 -66
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +2 -1
- 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 -103
- package/dist/node.esm.js.map +1 -1
- package/dist/{reactive/types.d.ts → types-W5vD6m2n.d.ts} +186 -93
- package/docs/ai/api-reference.md +12 -19
- package/docs/ai/manual.md +521 -17
- package/docs/events.md +57 -2
- package/docs/flavored.md +210 -0
- package/docs/reactive/advanced.md +314 -5
- package/docs/reactive/attend.md +142 -0
- package/docs/reactive/collections.md +76 -39
- package/docs/reactive/core.md +100 -14
- package/docs/reactive/debugging.md +123 -18
- package/docs/reactive/error-handling.md +121 -0
- package/docs/reactive/resource.md +125 -0
- package/docs/reactive/scan.md +247 -1
- package/docs/reactive.md +4 -1
- package/docs/std-decorators.md +102 -51
- package/docs/utils.md +70 -0
- package/docs/zone.md +3 -7
- package/package.json +64 -30
- package/dist/async/browser.d.ts +0 -2
- package/dist/async/browser.d.ts.map +0 -1
- package/dist/async/index.d.ts +0 -18
- package/dist/async/index.d.ts.map +0 -1
- package/dist/async/node.d.ts +0 -2
- package/dist/async/node.d.ts.map +0 -1
- package/dist/chunks/async-browser-CA0jPWIi.cjs.map +0 -1
- package/dist/chunks/async-core-UqHzvJ-S.cjs.map +0 -1
- package/dist/chunks/async-node-BYHuGTni.cjs.map +0 -1
- package/dist/chunks/index-DhaOVusv.esm.js +0 -6411
- package/dist/chunks/index-DhaOVusv.esm.js.map +0 -1
- package/dist/decorator.d.ts +0 -106
- package/dist/decorator.d.ts.map +0 -1
- package/dist/destroyable.d.ts +0 -87
- package/dist/destroyable.d.ts.map +0 -1
- package/dist/entry-browser.d.ts +0 -3
- package/dist/entry-browser.d.ts.map +0 -1
- package/dist/entry-node.d.ts +0 -3
- package/dist/entry-node.d.ts.map +0 -1
- package/dist/eventful.d.ts +0 -18
- package/dist/eventful.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/indexable.d.ts +0 -243
- package/dist/indexable.d.ts.map +0 -1
- package/dist/introspection.d.ts +0 -27
- package/dist/introspection.d.ts.map +0 -1
- package/dist/iterableWeak.d.ts +0 -53
- package/dist/iterableWeak.d.ts.map +0 -1
- package/dist/mixins.d.ts +0 -25
- package/dist/mixins.d.ts.map +0 -1
- package/dist/promiseChain.d.ts +0 -20
- package/dist/promiseChain.d.ts.map +0 -1
- package/dist/reactive/array.d.ts +0 -49
- package/dist/reactive/array.d.ts.map +0 -1
- package/dist/reactive/buffer.d.ts +0 -44
- package/dist/reactive/buffer.d.ts.map +0 -1
- package/dist/reactive/change.d.ts +0 -29
- package/dist/reactive/change.d.ts.map +0 -1
- package/dist/reactive/debug.d.ts +0 -111
- package/dist/reactive/debug.d.ts.map +0 -1
- package/dist/reactive/deep-touch.d.ts +0 -28
- package/dist/reactive/deep-touch.d.ts.map +0 -1
- package/dist/reactive/deep-watch-state.d.ts +0 -25
- package/dist/reactive/deep-watch-state.d.ts.map +0 -1
- package/dist/reactive/deep-watch.d.ts +0 -19
- package/dist/reactive/deep-watch.d.ts.map +0 -1
- package/dist/reactive/effect-context.d.ts +0 -7
- package/dist/reactive/effect-context.d.ts.map +0 -1
- package/dist/reactive/effects.d.ts +0 -151
- package/dist/reactive/effects.d.ts.map +0 -1
- package/dist/reactive/index.d.ts +0 -20
- package/dist/reactive/index.d.ts.map +0 -1
- package/dist/reactive/interface.d.ts +0 -64
- package/dist/reactive/interface.d.ts.map +0 -1
- package/dist/reactive/map.d.ts +0 -30
- package/dist/reactive/map.d.ts.map +0 -1
- package/dist/reactive/memoize.d.ts +0 -5
- package/dist/reactive/memoize.d.ts.map +0 -1
- package/dist/reactive/non-reactive-state.d.ts +0 -9
- package/dist/reactive/non-reactive-state.d.ts.map +0 -1
- package/dist/reactive/non-reactive.d.ts +0 -11
- package/dist/reactive/non-reactive.d.ts.map +0 -1
- package/dist/reactive/project.d.ts +0 -41
- package/dist/reactive/project.d.ts.map +0 -1
- package/dist/reactive/proxy-state.d.ts +0 -8
- package/dist/reactive/proxy-state.d.ts.map +0 -1
- package/dist/reactive/proxy.d.ts +0 -23
- package/dist/reactive/proxy.d.ts.map +0 -1
- package/dist/reactive/record.d.ts +0 -116
- package/dist/reactive/record.d.ts.map +0 -1
- package/dist/reactive/register.d.ts +0 -64
- package/dist/reactive/register.d.ts.map +0 -1
- package/dist/reactive/registry.d.ts +0 -20
- package/dist/reactive/registry.d.ts.map +0 -1
- package/dist/reactive/set.d.ts +0 -28
- package/dist/reactive/set.d.ts.map +0 -1
- package/dist/reactive/tracking.d.ts +0 -7
- package/dist/reactive/tracking.d.ts.map +0 -1
- package/dist/reactive/types.d.ts.map +0 -1
- package/dist/std-decorators.d.ts +0 -50
- package/dist/std-decorators.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -49
- package/dist/utils.d.ts.map +0 -1
- package/dist/zone.d.ts +0 -40
- package/dist/zone.d.ts.map +0 -1
- package/docs/reactive/project.md +0 -93
- package/src/async/browser.ts +0 -319
- package/src/async/index.ts +0 -23
- package/src/async/node.ts +0 -104
- 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 -77
- 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 -507
- package/src/reactive/buffer.ts +0 -168
- package/src/reactive/change.ts +0 -138
- package/src/reactive/debug.ts +0 -517
- package/src/reactive/deep-touch.ts +0 -268
- package/src/reactive/deep-watch-state.ts +0 -82
- package/src/reactive/deep-watch.ts +0 -168
- package/src/reactive/effect-context.ts +0 -18
- package/src/reactive/effects.ts +0 -1382
- package/src/reactive/index.ts +0 -75
- package/src/reactive/interface.ts +0 -210
- package/src/reactive/map.ts +0 -158
- package/src/reactive/memoize.ts +0 -163
- package/src/reactive/non-reactive-state.ts +0 -49
- package/src/reactive/non-reactive.ts +0 -43
- package/src/reactive/project.ts +0 -453
- package/src/reactive/proxy-state.ts +0 -27
- package/src/reactive/proxy.ts +0 -264
- package/src/reactive/record.ts +0 -196
- package/src/reactive/register.ts +0 -419
- package/src/reactive/registry.ts +0 -59
- package/src/reactive/set.ts +0 -130
- package/src/reactive/tracking.ts +0 -44
- package/src/reactive/types.ts +0 -440
- package/src/std-decorators.ts +0 -217
- package/src/utils.ts +0 -301
- package/src/zone.ts +0 -138
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)**
|
|
26
|
+
|
|
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.
|
|
33
|
+
|
|
34
|
+
---
|
|
14
35
|
|
|
15
|
-
## AI
|
|
36
|
+
## AI-First Architecture
|
|
16
37
|
|
|
17
|
-
|
|
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
|
|
@@ -145,7 +165,7 @@ A powerful mixin system that allows you to create reusable functionality that ca
|
|
|
145
165
|
|
|
146
166
|
A collection of standard decorators that shouldn't be implemented a 101-th time.
|
|
147
167
|
|
|
148
|
-
In extenso: cached,
|
|
168
|
+
In extenso: cached, descriptor(enumerable, configurable, writable) with flavors (.enumerable, .hidden, .configurable, .frozen, .writable, .readonly), deprecated, debounce, throttle
|
|
149
169
|
|
|
150
170
|
## [Decorator System](./docs/decorator.md)
|
|
151
171
|
|
|
@@ -216,4 +236,26 @@ A comprehensive resource management system that provides automatic cleanup for o
|
|
|
216
236
|
- Network resource management
|
|
217
237
|
- Memory management for large objects
|
|
218
238
|
- Plugin systems with proper cleanup
|
|
219
|
-
- Temporary resource management
|
|
239
|
+
- Temporary resource management
|
|
240
|
+
|
|
241
|
+
## [Flavored](./docs/flavored.md)
|
|
242
|
+
|
|
243
|
+
A utility for creating extensible functions with chainable property modifiers. Enables fluent APIs where properties return specialized variants of the base function.
|
|
244
|
+
|
|
245
|
+
**Key Features:**
|
|
246
|
+
- **Property-based Modifiers**: Add chainable properties to functions via getters or methods
|
|
247
|
+
- **Flavoring Robustness**: Automatic arity tracking and argument padding
|
|
248
|
+
- **Options Merging**: `flavorOptions` helper for automatic options object merging
|
|
249
|
+
- **Argument Transformation**: `createFlavor` helper for custom argument transformation
|
|
250
|
+
- **Hand-made Functions**: Return custom functions for complete control (the generic case)
|
|
251
|
+
- **Full TypeScript Support**: Proper type inference for chained modifiers
|
|
252
|
+
|
|
253
|
+
**Use Cases:**
|
|
254
|
+
- Creating functions with preset configurations (e.g., `effect.opaque`, `effect.named()`)
|
|
255
|
+
- Fluent APIs for function variants
|
|
256
|
+
- Partial application with named parameters
|
|
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
|
+
|