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.
Files changed (195) hide show
  1. package/README.md +77 -35
  2. package/dist/browser.cjs +2144 -5355
  3. package/dist/browser.cjs.map +1 -1
  4. package/dist/browser.d.ts +2 -1655
  5. package/dist/browser.dev.cjs +110 -0
  6. package/dist/browser.dev.cjs.map +1 -0
  7. package/dist/browser.dev.d.ts +2 -0
  8. package/dist/browser.dev.esm.js +5 -0
  9. package/dist/browser.dev.esm.js.map +1 -0
  10. package/dist/browser.esm.js +20 -107
  11. package/dist/browser.esm.js.map +1 -1
  12. package/dist/chunks/{async-browser-CA0jPWIi.cjs → async-browser-BU_IfxYD.cjs} +19 -107
  13. package/dist/chunks/async-browser-BU_IfxYD.cjs.map +1 -0
  14. package/dist/chunks/{async-core-UqHzvJ-S.cjs → async-core-CRLKP3l-.cjs} +8 -4
  15. package/dist/chunks/async-core-CRLKP3l-.cjs.map +1 -0
  16. package/dist/chunks/{async-node-BYHuGTni.cjs → async-node-3PrbVAbB.cjs} +7 -12
  17. package/dist/chunks/async-node-3PrbVAbB.cjs.map +1 -0
  18. package/dist/chunks/index-CaaQQlPJ.esm.js +3174 -0
  19. package/dist/chunks/index-CaaQQlPJ.esm.js.map +1 -0
  20. package/dist/chunks/node-nKJBk8iJ.esm.js +96 -0
  21. package/dist/chunks/node-nKJBk8iJ.esm.js.map +1 -0
  22. package/dist/chunks/proxy-Dtg-bJ3T.cjs +3763 -0
  23. package/dist/chunks/proxy-Dtg-bJ3T.cjs.map +1 -0
  24. package/dist/chunks/proxy-r7lARftl.esm.js +3701 -0
  25. package/dist/chunks/proxy-r7lARftl.esm.js.map +1 -0
  26. package/dist/debug.cjs +980 -0
  27. package/dist/debug.cjs.map +1 -0
  28. package/dist/debug.d.ts +208 -0
  29. package/dist/debug.esm.js +950 -0
  30. package/dist/debug.esm.js.map +1 -0
  31. package/dist/devtools/manifest.json +1 -1
  32. package/dist/devtools/panel.html +1 -1
  33. package/dist/devtools/panel.js +107 -94
  34. package/dist/devtools/panel.js.map +1 -1
  35. package/dist/index.d.ts +1447 -13
  36. package/dist/mutts.umd.js +7167 -1
  37. package/dist/mutts.umd.js.map +1 -1
  38. package/dist/mutts.umd.min.js +1 -1
  39. package/dist/mutts.umd.min.js.map +1 -1
  40. package/dist/node.cjs +70 -66
  41. package/dist/node.cjs.map +1 -1
  42. package/dist/node.d.ts +2 -1
  43. package/dist/node.dev.cjs +110 -0
  44. package/dist/node.dev.cjs.map +1 -0
  45. package/dist/node.dev.d.ts +2 -0
  46. package/dist/node.dev.esm.js +6 -0
  47. package/dist/node.dev.esm.js.map +1 -0
  48. package/dist/node.esm.js +4 -103
  49. package/dist/node.esm.js.map +1 -1
  50. package/dist/{reactive/types.d.ts → types-W5vD6m2n.d.ts} +186 -93
  51. package/docs/ai/api-reference.md +12 -19
  52. package/docs/ai/manual.md +521 -17
  53. package/docs/events.md +57 -2
  54. package/docs/flavored.md +210 -0
  55. package/docs/reactive/advanced.md +314 -5
  56. package/docs/reactive/attend.md +142 -0
  57. package/docs/reactive/collections.md +76 -39
  58. package/docs/reactive/core.md +100 -14
  59. package/docs/reactive/debugging.md +123 -18
  60. package/docs/reactive/error-handling.md +121 -0
  61. package/docs/reactive/resource.md +125 -0
  62. package/docs/reactive/scan.md +247 -1
  63. package/docs/reactive.md +4 -1
  64. package/docs/std-decorators.md +102 -51
  65. package/docs/utils.md +70 -0
  66. package/docs/zone.md +3 -7
  67. package/package.json +64 -30
  68. package/dist/async/browser.d.ts +0 -2
  69. package/dist/async/browser.d.ts.map +0 -1
  70. package/dist/async/index.d.ts +0 -18
  71. package/dist/async/index.d.ts.map +0 -1
  72. package/dist/async/node.d.ts +0 -2
  73. package/dist/async/node.d.ts.map +0 -1
  74. package/dist/chunks/async-browser-CA0jPWIi.cjs.map +0 -1
  75. package/dist/chunks/async-core-UqHzvJ-S.cjs.map +0 -1
  76. package/dist/chunks/async-node-BYHuGTni.cjs.map +0 -1
  77. package/dist/chunks/index-DhaOVusv.esm.js +0 -6411
  78. package/dist/chunks/index-DhaOVusv.esm.js.map +0 -1
  79. package/dist/decorator.d.ts +0 -106
  80. package/dist/decorator.d.ts.map +0 -1
  81. package/dist/destroyable.d.ts +0 -87
  82. package/dist/destroyable.d.ts.map +0 -1
  83. package/dist/entry-browser.d.ts +0 -3
  84. package/dist/entry-browser.d.ts.map +0 -1
  85. package/dist/entry-node.d.ts +0 -3
  86. package/dist/entry-node.d.ts.map +0 -1
  87. package/dist/eventful.d.ts +0 -18
  88. package/dist/eventful.d.ts.map +0 -1
  89. package/dist/index.d.ts.map +0 -1
  90. package/dist/indexable.d.ts +0 -243
  91. package/dist/indexable.d.ts.map +0 -1
  92. package/dist/introspection.d.ts +0 -27
  93. package/dist/introspection.d.ts.map +0 -1
  94. package/dist/iterableWeak.d.ts +0 -53
  95. package/dist/iterableWeak.d.ts.map +0 -1
  96. package/dist/mixins.d.ts +0 -25
  97. package/dist/mixins.d.ts.map +0 -1
  98. package/dist/promiseChain.d.ts +0 -20
  99. package/dist/promiseChain.d.ts.map +0 -1
  100. package/dist/reactive/array.d.ts +0 -49
  101. package/dist/reactive/array.d.ts.map +0 -1
  102. package/dist/reactive/buffer.d.ts +0 -44
  103. package/dist/reactive/buffer.d.ts.map +0 -1
  104. package/dist/reactive/change.d.ts +0 -29
  105. package/dist/reactive/change.d.ts.map +0 -1
  106. package/dist/reactive/debug.d.ts +0 -111
  107. package/dist/reactive/debug.d.ts.map +0 -1
  108. package/dist/reactive/deep-touch.d.ts +0 -28
  109. package/dist/reactive/deep-touch.d.ts.map +0 -1
  110. package/dist/reactive/deep-watch-state.d.ts +0 -25
  111. package/dist/reactive/deep-watch-state.d.ts.map +0 -1
  112. package/dist/reactive/deep-watch.d.ts +0 -19
  113. package/dist/reactive/deep-watch.d.ts.map +0 -1
  114. package/dist/reactive/effect-context.d.ts +0 -7
  115. package/dist/reactive/effect-context.d.ts.map +0 -1
  116. package/dist/reactive/effects.d.ts +0 -151
  117. package/dist/reactive/effects.d.ts.map +0 -1
  118. package/dist/reactive/index.d.ts +0 -20
  119. package/dist/reactive/index.d.ts.map +0 -1
  120. package/dist/reactive/interface.d.ts +0 -64
  121. package/dist/reactive/interface.d.ts.map +0 -1
  122. package/dist/reactive/map.d.ts +0 -30
  123. package/dist/reactive/map.d.ts.map +0 -1
  124. package/dist/reactive/memoize.d.ts +0 -5
  125. package/dist/reactive/memoize.d.ts.map +0 -1
  126. package/dist/reactive/non-reactive-state.d.ts +0 -9
  127. package/dist/reactive/non-reactive-state.d.ts.map +0 -1
  128. package/dist/reactive/non-reactive.d.ts +0 -11
  129. package/dist/reactive/non-reactive.d.ts.map +0 -1
  130. package/dist/reactive/project.d.ts +0 -41
  131. package/dist/reactive/project.d.ts.map +0 -1
  132. package/dist/reactive/proxy-state.d.ts +0 -8
  133. package/dist/reactive/proxy-state.d.ts.map +0 -1
  134. package/dist/reactive/proxy.d.ts +0 -23
  135. package/dist/reactive/proxy.d.ts.map +0 -1
  136. package/dist/reactive/record.d.ts +0 -116
  137. package/dist/reactive/record.d.ts.map +0 -1
  138. package/dist/reactive/register.d.ts +0 -64
  139. package/dist/reactive/register.d.ts.map +0 -1
  140. package/dist/reactive/registry.d.ts +0 -20
  141. package/dist/reactive/registry.d.ts.map +0 -1
  142. package/dist/reactive/set.d.ts +0 -28
  143. package/dist/reactive/set.d.ts.map +0 -1
  144. package/dist/reactive/tracking.d.ts +0 -7
  145. package/dist/reactive/tracking.d.ts.map +0 -1
  146. package/dist/reactive/types.d.ts.map +0 -1
  147. package/dist/std-decorators.d.ts +0 -50
  148. package/dist/std-decorators.d.ts.map +0 -1
  149. package/dist/utils.d.ts +0 -49
  150. package/dist/utils.d.ts.map +0 -1
  151. package/dist/zone.d.ts +0 -40
  152. package/dist/zone.d.ts.map +0 -1
  153. package/docs/reactive/project.md +0 -93
  154. package/src/async/browser.ts +0 -319
  155. package/src/async/index.ts +0 -23
  156. package/src/async/node.ts +0 -104
  157. package/src/decorator.ts +0 -272
  158. package/src/destroyable.ts +0 -199
  159. package/src/entry-browser.ts +0 -5
  160. package/src/entry-node.ts +0 -5
  161. package/src/eventful.ts +0 -77
  162. package/src/index.d.ts +0 -12
  163. package/src/index.ts +0 -64
  164. package/src/indexable.ts +0 -526
  165. package/src/introspection.ts +0 -59
  166. package/src/iterableWeak.ts +0 -233
  167. package/src/mixins.ts +0 -123
  168. package/src/promiseChain.ts +0 -110
  169. package/src/reactive/array.ts +0 -507
  170. package/src/reactive/buffer.ts +0 -168
  171. package/src/reactive/change.ts +0 -138
  172. package/src/reactive/debug.ts +0 -517
  173. package/src/reactive/deep-touch.ts +0 -268
  174. package/src/reactive/deep-watch-state.ts +0 -82
  175. package/src/reactive/deep-watch.ts +0 -168
  176. package/src/reactive/effect-context.ts +0 -18
  177. package/src/reactive/effects.ts +0 -1382
  178. package/src/reactive/index.ts +0 -75
  179. package/src/reactive/interface.ts +0 -210
  180. package/src/reactive/map.ts +0 -158
  181. package/src/reactive/memoize.ts +0 -163
  182. package/src/reactive/non-reactive-state.ts +0 -49
  183. package/src/reactive/non-reactive.ts +0 -43
  184. package/src/reactive/project.ts +0 -453
  185. package/src/reactive/proxy-state.ts +0 -27
  186. package/src/reactive/proxy.ts +0 -264
  187. package/src/reactive/record.ts +0 -196
  188. package/src/reactive/register.ts +0 -419
  189. package/src/reactive/registry.ts +0 -59
  190. package/src/reactive/set.ts +0 -130
  191. package/src/reactive/tracking.ts +0 -44
  192. package/src/reactive/types.ts +0 -440
  193. package/src/std-decorators.ts +0 -217
  194. package/src/utils.ts +0 -301
  195. package/src/zone.ts +0 -138
package/README.md CHANGED
@@ -1,57 +1,77 @@
1
- # Modern UTility TS
1
+ # Mutts: The Affirmative Utility Framework
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/mutts.svg)](https://badge.fury.io/js/mutts)
4
4
 
5
- Basically, just a bunch of utilities that have many versions on the web, but none fitting my needs, so that I re-created every time.
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
- With the advent of AI, I could finally manage to have something finished and complete.
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
- ## Installation
9
+ ---
10
10
 
11
- ```bash
12
- npm install mutts
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 Agents & Automated Tooling
36
+ ## AI-First Architecture
16
37
 
17
- > [!TIP]
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
- > If you are an LLM or autonomous agent trying to fix bugs or understand this codebase, please read the **[AI Agent Manual](./docs/ai/manual.md)**.
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
- ## Usage
44
+ ---
24
45
 
25
- ### Import from Built Modules
46
+ ## The "Affirmative" Philosophy
26
47
 
27
- ```typescript
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
- ### Import from Source Files
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
- ```typescript
38
- // Import directly from source TypeScript files (for development/custom builds)
39
- import { reactive, effect, Reactive } from 'mutts'
40
- import { mixin } from 'mutts/mixin'
41
- import { cached } from 'mutts/std-decorators'
42
- import { Destroyable, allocated } from 'mutts/destroyable'
55
+ ---
56
+
57
+ ## Installation & Usage
58
+
59
+ ```bash
60
+ npm install mutts
43
61
  ```
44
62
 
45
- **Note:** When importing from source files, you'll need to configure your build system (TypeScript, Vite, Webpack, etc.) to handle TypeScript compilation and module resolution. The source files are published alongside the built modules, so you can import directly from the `src` directory.
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
- ### Environment Setup (Node vs Browser)
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 `wrap` in Browser).
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()`, `project()`, and `scan()`
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, describe(enumerable, configurable, writable), deprecated, debounce, throttle
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
+