mutts 1.0.2 → 1.0.4
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 +14 -6
- package/dist/chunks/{_tslib-C-cuVLvZ.js → _tslib-BgjropY9.js} +9 -1
- package/dist/chunks/_tslib-BgjropY9.js.map +1 -0
- package/dist/chunks/{_tslib-CMEnd0VE.esm.js → _tslib-Mzh1rNsX.esm.js} +9 -2
- package/dist/chunks/_tslib-Mzh1rNsX.esm.js.map +1 -0
- package/dist/chunks/{decorator-D4DU97Zg.js → decorator-DLvrD0UF.js} +42 -19
- package/dist/chunks/decorator-DLvrD0UF.js.map +1 -0
- package/dist/chunks/{decorator-GnHw1Az7.esm.js → decorator-DqiszP7i.esm.js} +42 -19
- package/dist/chunks/decorator-DqiszP7i.esm.js.map +1 -0
- package/dist/chunks/index-79Kk8D6e.esm.js +4857 -0
- package/dist/chunks/index-79Kk8D6e.esm.js.map +1 -0
- package/dist/chunks/index-GRBSx0mB.js +4908 -0
- package/dist/chunks/index-GRBSx0mB.js.map +1 -0
- package/dist/decorator.esm.js +1 -1
- package/dist/decorator.js +1 -1
- package/dist/destroyable.d.ts +1 -1
- package/dist/destroyable.esm.js +1 -1
- package/dist/destroyable.esm.js.map +1 -1
- package/dist/destroyable.js +1 -1
- package/dist/destroyable.js.map +1 -1
- package/dist/devtools/devtools.html +9 -0
- package/dist/devtools/devtools.js +5 -0
- package/dist/devtools/devtools.js.map +1 -0
- package/dist/devtools/manifest.json +8 -0
- package/dist/devtools/panel.css +72 -0
- package/dist/devtools/panel.html +31 -0
- package/dist/devtools/panel.js +13048 -0
- package/dist/devtools/panel.js.map +1 -0
- package/dist/eventful.esm.js +1 -1
- package/dist/eventful.js +1 -1
- package/dist/index.d.ts +18 -63
- package/dist/index.esm.js +4 -4
- package/dist/index.js +37 -11
- package/dist/index.js.map +1 -1
- package/dist/indexable.d.ts +187 -1
- package/dist/indexable.esm.js +197 -3
- package/dist/indexable.esm.js.map +1 -1
- package/dist/indexable.js +198 -2
- package/dist/indexable.js.map +1 -1
- package/dist/mutts.umd.js +1 -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/promiseChain.esm.js.map +1 -1
- package/dist/promiseChain.js.map +1 -1
- package/dist/reactive.d.ts +602 -97
- package/dist/reactive.esm.js +3 -3
- package/dist/reactive.js +32 -10
- package/dist/reactive.js.map +1 -1
- package/dist/std-decorators.esm.js +1 -1
- package/dist/std-decorators.js +1 -1
- package/docs/ai/api-reference.md +133 -0
- package/docs/ai/manual.md +105 -0
- package/docs/iterableWeak.md +646 -0
- package/docs/reactive/advanced.md +1280 -0
- package/docs/reactive/collections.md +767 -0
- package/docs/reactive/core.md +973 -0
- package/docs/reactive.md +21 -9545
- package/package.json +18 -5
- package/src/decorator.ts +266 -0
- package/src/destroyable.ts +199 -0
- package/src/eventful.ts +77 -0
- package/src/index.d.ts +9 -0
- package/src/index.ts +9 -0
- package/src/indexable.ts +484 -0
- package/src/introspection.ts +59 -0
- package/src/iterableWeak.ts +233 -0
- package/src/mixins.ts +123 -0
- package/src/promiseChain.ts +110 -0
- package/src/reactive/array.ts +414 -0
- package/src/reactive/change.ts +134 -0
- package/src/reactive/debug.ts +517 -0
- package/src/reactive/deep-touch.ts +268 -0
- package/src/reactive/deep-watch-state.ts +82 -0
- package/src/reactive/deep-watch.ts +168 -0
- package/src/reactive/effect-context.ts +94 -0
- package/src/reactive/effects.ts +1345 -0
- package/src/reactive/index.ts +76 -0
- package/src/reactive/interface.ts +223 -0
- package/src/reactive/map.ts +171 -0
- package/src/reactive/mapped.ts +130 -0
- package/src/reactive/memoize.ts +107 -0
- package/src/reactive/non-reactive-state.ts +49 -0
- package/src/reactive/non-reactive.ts +43 -0
- package/src/reactive/project.project.md +93 -0
- package/src/reactive/project.ts +335 -0
- package/src/reactive/proxy-state.ts +27 -0
- package/src/reactive/proxy.ts +289 -0
- package/src/reactive/record.ts +196 -0
- package/src/reactive/register.ts +421 -0
- package/src/reactive/set.ts +144 -0
- package/src/reactive/tracking.ts +101 -0
- package/src/reactive/types.ts +358 -0
- package/src/reactive/zone.ts +208 -0
- package/src/std-decorators.ts +217 -0
- package/src/utils.ts +117 -0
- package/dist/chunks/_tslib-C-cuVLvZ.js.map +0 -1
- package/dist/chunks/_tslib-CMEnd0VE.esm.js.map +0 -1
- package/dist/chunks/decorator-D4DU97Zg.js.map +0 -1
- package/dist/chunks/decorator-GnHw1Az7.esm.js.map +0 -1
- package/dist/chunks/index-DBScoeCX.esm.js +0 -1960
- package/dist/chunks/index-DBScoeCX.esm.js.map +0 -1
- package/dist/chunks/index-DOTmXL89.js +0 -1983
- package/dist/chunks/index-DOTmXL89.js.map +0 -1
package/README.md
CHANGED
|
@@ -12,6 +12,14 @@ With the advent of AI, I could finally manage to have something finished and com
|
|
|
12
12
|
npm install mutts
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## AI Agents & Automated Tooling
|
|
16
|
+
|
|
17
|
+
> [!TIP]
|
|
18
|
+
> **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.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.
|
|
22
|
+
|
|
15
23
|
## Usage
|
|
16
24
|
|
|
17
25
|
### Import from Built Modules
|
|
@@ -28,10 +36,10 @@ import { Destroyable, allocated } from 'mutts/destroyable'
|
|
|
28
36
|
|
|
29
37
|
```typescript
|
|
30
38
|
// Import directly from source TypeScript files (for development/custom builds)
|
|
31
|
-
import { reactive, effect, Reactive } from 'mutts
|
|
32
|
-
import { mixin } from 'mutts/
|
|
33
|
-
import { cached } from 'mutts/
|
|
34
|
-
import { Destroyable, allocated } from 'mutts/
|
|
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'
|
|
35
43
|
```
|
|
36
44
|
|
|
37
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.
|
|
@@ -152,10 +160,10 @@ A comprehensive resource management system that provides automatic cleanup for o
|
|
|
152
160
|
|
|
153
161
|
## [Reactive](./docs/reactive.md)
|
|
154
162
|
|
|
155
|
-
A comprehensive reactivity system
|
|
163
|
+
A comprehensive reactivity system. See the **[Introduction](./docs/reactive/core.md)** or browse the **[Table of Contents](./docs/reactive.md)**.
|
|
156
164
|
|
|
157
165
|
**Key Features:**
|
|
158
|
-
- **Core Reactivity**: Proxy-based property access tracking with `reactive()`, `effect()`, and `
|
|
166
|
+
- **Core Reactivity**: Proxy-based property access tracking with `reactive()`, `effect()`, and `memoize()`
|
|
159
167
|
- **Deep Watching**: Automatic tracking of nested object changes with `deepWatch()`
|
|
160
168
|
- **Reactive Collections**: Specialized reactive versions of Array, Map, Set, WeakMap, and WeakSet
|
|
161
169
|
- **Class Reactivity**: `@reactive` decorator and `ReactiveBase` for class-based reactivity
|
|
@@ -61,13 +61,21 @@ function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
|
61
61
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
65
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
66
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
67
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
68
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
69
|
+
}
|
|
70
|
+
|
|
64
71
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
65
72
|
var e = new Error(message);
|
|
66
73
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
67
74
|
};
|
|
68
75
|
|
|
69
76
|
exports.__classPrivateFieldGet = __classPrivateFieldGet;
|
|
77
|
+
exports.__classPrivateFieldSet = __classPrivateFieldSet;
|
|
70
78
|
exports.__esDecorate = __esDecorate;
|
|
71
79
|
exports.__runInitializers = __runInitializers;
|
|
72
80
|
exports.__setFunctionName = __setFunctionName;
|
|
73
|
-
//# sourceMappingURL=_tslib-
|
|
81
|
+
//# sourceMappingURL=_tslib-BgjropY9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_tslib-BgjropY9.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -59,10 +59,17 @@ function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
|
59
59
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
63
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
64
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
65
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
66
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
67
|
+
}
|
|
68
|
+
|
|
62
69
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
63
70
|
var e = new Error(message);
|
|
64
71
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
65
72
|
};
|
|
66
73
|
|
|
67
|
-
export { __classPrivateFieldGet as _, __setFunctionName as a, __esDecorate as b, __runInitializers as c };
|
|
68
|
-
//# sourceMappingURL=_tslib-
|
|
74
|
+
export { __classPrivateFieldGet as _, __setFunctionName as a, __esDecorate as b, __runInitializers as c, __classPrivateFieldSet as d };
|
|
75
|
+
//# sourceMappingURL=_tslib-Mzh1rNsX.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_tslib-Mzh1rNsX.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -16,6 +16,25 @@ function zip(...args) {
|
|
|
16
16
|
}
|
|
17
17
|
return result;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Checks if two arrays are strictly equal (shallow comparison)
|
|
21
|
+
* @param a - First value
|
|
22
|
+
* @param b - Second value
|
|
23
|
+
* @returns True if arrays are equal or values are strictly equal
|
|
24
|
+
*/
|
|
25
|
+
function arrayEquals(a, b) {
|
|
26
|
+
if (a === b)
|
|
27
|
+
return true;
|
|
28
|
+
if (!Array.isArray(a) || !Array.isArray(b))
|
|
29
|
+
return false;
|
|
30
|
+
if (a.length !== b.length)
|
|
31
|
+
return false;
|
|
32
|
+
for (let i = 0; i < a.length; i++) {
|
|
33
|
+
if (a[i] !== b[i])
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
19
38
|
const nativeConstructors = new Set([
|
|
20
39
|
Object,
|
|
21
40
|
Array,
|
|
@@ -73,7 +92,16 @@ function ReflectSet(obj, prop, value, receiver) {
|
|
|
73
92
|
// Check if Node is available and obj is an instance of Node
|
|
74
93
|
if (typeof Node !== 'undefined' && obj instanceof Node) {
|
|
75
94
|
obj[prop] = value;
|
|
76
|
-
return
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
if (!(obj instanceof Object) && !Reflect.has(obj, prop)) {
|
|
98
|
+
Object.defineProperty(obj, prop, {
|
|
99
|
+
value,
|
|
100
|
+
configurable: true,
|
|
101
|
+
writable: true,
|
|
102
|
+
enumerable: true,
|
|
103
|
+
});
|
|
104
|
+
return true;
|
|
77
105
|
}
|
|
78
106
|
return Reflect.set(obj, prop, value, receiver);
|
|
79
107
|
}
|
|
@@ -81,12 +109,6 @@ function isOwnAccessor(obj, prop) {
|
|
|
81
109
|
const opd = Object.getOwnPropertyDescriptor(obj, prop);
|
|
82
110
|
return !!(opd?.get || opd?.set);
|
|
83
111
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Check if an object is an object (not null, not primitive)
|
|
86
|
-
*/
|
|
87
|
-
function isObject(obj) {
|
|
88
|
-
return obj !== null && typeof obj === 'object';
|
|
89
|
-
}
|
|
90
112
|
|
|
91
113
|
// biome-ignore-all lint/suspicious/noConfusingVoidType: We *love* voids
|
|
92
114
|
// Standardized decorator system that works with both Legacy and Modern decorators
|
|
@@ -110,7 +132,7 @@ function legacyDecorator(description) {
|
|
|
110
132
|
if (isConstructor(target)) {
|
|
111
133
|
if (!('class' in description))
|
|
112
134
|
throw new Error('Decorator cannot be applied to a class');
|
|
113
|
-
return description.class
|
|
135
|
+
return description.class(target);
|
|
114
136
|
}
|
|
115
137
|
}
|
|
116
138
|
else if (typeof target === 'object' && ['string', 'symbol'].includes(typeof propertyKey)) {
|
|
@@ -121,12 +143,12 @@ function legacyDecorator(description) {
|
|
|
121
143
|
if (!('getter' in description || 'setter' in description))
|
|
122
144
|
throw new Error('Decorator cannot be applied to a getter or setter');
|
|
123
145
|
if ('getter' in description) {
|
|
124
|
-
const newGetter = description.getter
|
|
146
|
+
const newGetter = description.getter(descriptor.get, propertyKey);
|
|
125
147
|
if (newGetter)
|
|
126
148
|
descriptor.get = newGetter;
|
|
127
149
|
}
|
|
128
150
|
if ('setter' in description) {
|
|
129
|
-
const newSetter = description.setter
|
|
151
|
+
const newSetter = description.setter(descriptor.set, propertyKey);
|
|
130
152
|
if (newSetter)
|
|
131
153
|
descriptor.set = newSetter;
|
|
132
154
|
}
|
|
@@ -135,7 +157,7 @@ function legacyDecorator(description) {
|
|
|
135
157
|
else if (typeof descriptor.value === 'function') {
|
|
136
158
|
if (!('method' in description))
|
|
137
159
|
throw new Error('Decorator cannot be applied to a method');
|
|
138
|
-
const newMethod = description.method
|
|
160
|
+
const newMethod = description.method(descriptor.value, propertyKey);
|
|
139
161
|
if (newMethod)
|
|
140
162
|
descriptor.value = newMethod;
|
|
141
163
|
return descriptor;
|
|
@@ -153,6 +175,7 @@ function legacyDecorator(description) {
|
|
|
153
175
|
* @returns A decorator function compatible with Modern decorators
|
|
154
176
|
*/
|
|
155
177
|
function modernDecorator(description) {
|
|
178
|
+
/*return function (target: any, context?: DecoratorContext, ...args: any[]) {*/
|
|
156
179
|
return function (target, context, ...args) {
|
|
157
180
|
if (!context?.kind || typeof context.kind !== 'string') {
|
|
158
181
|
if (!('default' in description))
|
|
@@ -163,32 +186,32 @@ function modernDecorator(description) {
|
|
|
163
186
|
case 'class':
|
|
164
187
|
if (!('class' in description))
|
|
165
188
|
throw new Error('Decorator cannot be applied to a class');
|
|
166
|
-
return description.class
|
|
189
|
+
return description.class(target);
|
|
167
190
|
case 'field':
|
|
168
191
|
throw new Error('Decorator cannot be applied to a field');
|
|
169
192
|
case 'getter':
|
|
170
193
|
if (!('getter' in description))
|
|
171
194
|
throw new Error('Decorator cannot be applied to a getter');
|
|
172
|
-
return description.getter
|
|
195
|
+
return description.getter(target, context.name);
|
|
173
196
|
case 'setter':
|
|
174
197
|
if (!('setter' in description))
|
|
175
198
|
throw new Error('Decorator cannot be applied to a setter');
|
|
176
|
-
return description.setter
|
|
199
|
+
return description.setter(target, context.name);
|
|
177
200
|
case 'method':
|
|
178
201
|
if (!('method' in description))
|
|
179
202
|
throw new Error('Decorator cannot be applied to a method');
|
|
180
|
-
return description.method
|
|
203
|
+
return description.method(target, context.name);
|
|
181
204
|
case 'accessor': {
|
|
182
205
|
if (!('getter' in description || 'setter' in description))
|
|
183
206
|
throw new Error('Decorator cannot be applied to a getter or setter');
|
|
184
207
|
const rv = {};
|
|
185
208
|
if ('getter' in description) {
|
|
186
|
-
const newGetter = description.getter
|
|
209
|
+
const newGetter = description.getter(target.get, context.name);
|
|
187
210
|
if (newGetter)
|
|
188
211
|
rv.get = newGetter;
|
|
189
212
|
}
|
|
190
213
|
if ('setter' in description) {
|
|
191
|
-
const newSetter = description.setter
|
|
214
|
+
const newSetter = description.setter(target.set, context.name);
|
|
192
215
|
if (newSetter)
|
|
193
216
|
rv.set = newSetter;
|
|
194
217
|
}
|
|
@@ -231,12 +254,12 @@ const decorator = (description) => {
|
|
|
231
254
|
exports.DecoratorError = DecoratorError;
|
|
232
255
|
exports.ReflectGet = ReflectGet;
|
|
233
256
|
exports.ReflectSet = ReflectSet;
|
|
257
|
+
exports.arrayEquals = arrayEquals;
|
|
234
258
|
exports.decorator = decorator;
|
|
235
259
|
exports.isConstructor = isConstructor;
|
|
236
|
-
exports.isObject = isObject;
|
|
237
260
|
exports.isOwnAccessor = isOwnAccessor;
|
|
238
261
|
exports.legacyDecorator = legacyDecorator;
|
|
239
262
|
exports.modernDecorator = modernDecorator;
|
|
240
263
|
exports.renamed = renamed;
|
|
241
264
|
exports.zip = zip;
|
|
242
|
-
//# sourceMappingURL=decorator-
|
|
265
|
+
//# sourceMappingURL=decorator-DLvrD0UF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator-DLvrD0UF.js","sources":["../../src/utils.ts","../../src/decorator.ts"],"sourcesContent":["type ElementTypes<T extends readonly unknown[]> = {\n\t[K in keyof T]: T[K] extends readonly (infer U)[] ? U : T[K]\n}\n\n/**\n * Combines multiple arrays into an array of tuples, stopping at the shortest array length\n * @param args - Arrays to zip together\n * @returns Array of tuples containing elements from each input array\n */\nexport function zip<T extends (readonly unknown[])[]>(...args: T): ElementTypes<T>[] {\n\tif (!args.length) return []\n\tconst minLength = Math.min(...args.map((arr) => arr.length))\n\tconst result: ElementTypes<T>[] = []\n\n\tfor (let i = 0; i < minLength; i++) {\n\t\tconst tuple = args.map((arr) => arr[i]) as ElementTypes<T>\n\t\tresult.push(tuple)\n\t}\n\n\treturn result\n}\n\n/**\n * Checks if two arrays are strictly equal (shallow comparison)\n * @param a - First value\n * @param b - Second value\n * @returns True if arrays are equal or values are strictly equal\n */\nexport function arrayEquals(a: any, b: any): boolean {\n\tif (a === b) return true\n\tif (!Array.isArray(a) || !Array.isArray(b)) return false\n\tif (a.length !== b.length) return false\n\tfor (let i = 0; i < a.length; i++) {\n\t\tif (a[i] !== b[i]) return false\n\t}\n\treturn true\n}\n\nconst nativeConstructors = new Set<Function>([\n\tObject,\n\tArray,\n\tDate,\n\tFunction,\n\tSet,\n\tMap,\n\tWeakMap,\n\tWeakSet,\n\tPromise,\n\tError,\n\tTypeError,\n\tReferenceError,\n\tSyntaxError,\n\tRangeError,\n\tURIError,\n\tEvalError,\n\tReflect,\n\tProxy,\n\tRegExp,\n\tString,\n\tNumber,\n\tBoolean,\n] as Function[])\n/**\n * Checks if a function is a constructor (class or constructor function)\n * @param fn - The function to check\n * @returns True if the function is a constructor\n */\nexport function isConstructor(fn: Function): boolean {\n\treturn (\n\t\tfn &&\n\t\ttypeof fn === 'function' &&\n\t\t(nativeConstructors.has(fn) || fn.toString?.().startsWith('class '))\n\t)\n}\n\n/**\n * Renames a function with a new name\n * @param fct - The function to rename\n * @param name - The new name for the function\n * @returns The function with the new name\n */\nexport function renamed<F extends Function>(fct: F, name: string): F {\n\treturn Object.defineProperties(fct, {\n\t\tname: {\n\t\t\tvalue: name,\n\t\t},\n\t})\n}\n\nexport function ReflectGet(obj: any, prop: any, receiver: any) {\n\t// Check if Node is available and obj is an instance of Node\n\tif (typeof Node !== 'undefined' && obj instanceof Node) return (obj as any)[prop]\n\treturn Reflect.get(obj, prop, receiver)\n}\n\nexport function ReflectSet(obj: any, prop: any, value: any, receiver: any) {\n\t// Check if Node is available and obj is an instance of Node\n\tif (typeof Node !== 'undefined' && obj instanceof Node) {\n\t\t;(obj as any)[prop] = value\n\t\treturn true\n\t}\n\tif (!(obj instanceof Object) && !Reflect.has(obj, prop)) {\n\t\tObject.defineProperty(obj, prop, {\n\t\t\tvalue,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tenumerable: true,\n\t\t})\n\t\treturn true\n\t}\n\treturn Reflect.set(obj, prop, value, receiver)\n}\n\nexport function isOwnAccessor(obj: any, prop: any) {\n\tconst opd = Object.getOwnPropertyDescriptor(obj, prop)\n\treturn !!(opd?.get || opd?.set)\n}\n","// biome-ignore-all lint/suspicious/noConfusingVoidType: We *love* voids\n// Standardized decorator system that works with both Legacy and Modern decorators\n\nimport { isConstructor } from './utils'\n\n/**\n * Error thrown when decorator operations fail\n */\nexport class DecoratorError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'DecoratorException'\n\t}\n}\n//#region all decorator types\n\n// Used for get/set and method decorators\n/**\n * Legacy property decorator type for methods, getters, and setters\n */\nexport type LegacyPropertyDecorator<T> = (\n\ttarget: T,\n\tname: string | symbol,\n\tdescriptor: PropertyDescriptor\n) => any\n\n/**\n * Legacy class decorator type\n */\nexport type LegacyClassDecorator<T> = (target: T) => any\n\n/**\n * Modern method decorator type\n */\nexport type ModernMethodDecorator<T> = (target: T, context: ClassMethodDecoratorContext) => any\n\n/**\n * Modern getter decorator type\n */\nexport type ModernGetterDecorator<T> = (target: T, context: ClassGetterDecoratorContext) => any\n\n/**\n * Modern setter decorator type\n */\nexport type ModernSetterDecorator<T> = (target: T, context: ClassSetterDecoratorContext) => any\n\n/**\n * Modern accessor decorator type\n */\nexport type ModernAccessorDecorator<T> = (target: T, context: ClassAccessorDecoratorContext) => any\n\n/**\n * Modern class decorator type\n */\nexport type ModernClassDecorator<T> = (target: T, context: ClassDecoratorContext) => any\n\n//#endregion\n\ntype DDMethod<T> = (\n\toriginal: (this: T, ...args: any[]) => any,\n\tname: PropertyKey\n) => ((this: T, ...args: any[]) => any) | void\n\ntype DDGetter<T> = (original: (this: T) => any, name: PropertyKey) => ((this: T) => any) | void\n\ntype DDSetter<T> = (\n\toriginal: (this: T, value: any) => void,\n\tname: PropertyKey\n) => ((this: T, value: any) => void) | void\n\ntype DDClass<T> = <Ctor extends new (...args: any[]) => T = new (...args: any[]) => T>(\n\ttarget: Ctor\n) => Ctor | void\n/**\n * Description object for creating decorators that work with both Legacy and Modern decorator proposals\n */\nexport interface DecoratorDescription<T> {\n\t/** Handler for method decorators */\n\tmethod?: DDMethod<T>\n\t/** Handler for class decorators */\n\tclass?: DDClass<T>\n\t/** Handler for getter decorators */\n\tgetter?: DDGetter<T>\n\t/** Handler for setter decorators */\n\tsetter?: DDSetter<T>\n\t/** Default handler for any decorator type not explicitly defined */\n\tdefault?: (...args: any[]) => any\n}\n\n/**\n * Type for decorators that work with both Legacy and Modern decorator proposals\n * Automatically infers the correct decorator type based on the description\n */\nexport type Decorator<T, Description extends DecoratorDescription<T>> = (Description extends {\n\tmethod: DDMethod<T>\n}\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\n/**\n * Factory type for creating decorators that work with both Legacy and Modern decorator proposals\n */\nexport type DecoratorFactory<T> = <Description extends DecoratorDescription<T>>(\n\tdescription: Description\n) => (Description extends { method: DDMethod<T> }\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\n/**\n * Creates a decorator that works with Legacy decorator proposals\n * @param description - The decorator description object\n * @returns A decorator function compatible with Legacy decorators\n */\nexport function legacyDecorator<T = any>(description: DecoratorDescription<T>): any {\n\treturn function (\n\t\tthis: any,\n\t\ttarget: any,\n\t\tpropertyKey?: PropertyKey,\n\t\tdescriptor?: PropertyDescriptor,\n\t\t...args: any[]\n\t) {\n\t\tif (propertyKey === undefined) {\n\t\t\tif (isConstructor(target)) {\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class!(target)\n\t\t\t}\n\t\t} else if (typeof target === 'object' && ['string', 'symbol'].includes(typeof propertyKey)) {\n\t\t\tif (!descriptor) throw new Error('Decorator cannot be applied to a field')\n\t\t\telse if (typeof descriptor === 'object' && 'configurable' in descriptor) {\n\t\t\t\tif ('get' in descriptor || 'set' in descriptor) {\n\t\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\t\tif ('getter' in description) {\n\t\t\t\t\t\tconst newGetter = description.getter!(descriptor.get as any, propertyKey)\n\t\t\t\t\t\tif (newGetter) descriptor.get = newGetter\n\t\t\t\t\t}\n\t\t\t\t\tif ('setter' in description) {\n\t\t\t\t\t\tconst newSetter = description.setter!(descriptor.set as any, propertyKey)\n\t\t\t\t\t\tif (newSetter) descriptor.set = newSetter\n\t\t\t\t\t}\n\t\t\t\t\treturn descriptor\n\t\t\t\t} else if (typeof descriptor.value === 'function') {\n\t\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\t\tconst newMethod = description.method!(descriptor.value, propertyKey)\n\t\t\t\t\tif (newMethod) descriptor.value = newMethod\n\t\t\t\t\treturn descriptor\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!('default' in description))\n\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\treturn description.default!.call(this, target, propertyKey, descriptor, ...args)\n\t}\n}\n\n/**\n * Creates a decorator that works with Modern decorator proposals\n * @param description - The decorator description object\n * @returns A decorator function compatible with Modern decorators\n */\nexport function modernDecorator<T = any>(description: DecoratorDescription<T>): any {\n\t/*return function (target: any, context?: DecoratorContext, ...args: any[]) {*/\n\treturn function (this: any, target: any, context?: DecoratorContext, ...args: any[]) {\n\t\tif (!context?.kind || typeof context.kind !== 'string') {\n\t\t\tif (!('default' in description))\n\t\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\t\treturn description.default!.call(this, target, context, ...args)\n\t\t}\n\t\tswitch (context.kind) {\n\t\t\tcase 'class':\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class!(target)\n\t\t\tcase 'field':\n\t\t\t\tthrow new Error('Decorator cannot be applied to a field')\n\t\t\tcase 'getter':\n\t\t\t\tif (!('getter' in description)) throw new Error('Decorator cannot be applied to a getter')\n\t\t\t\treturn description.getter!(target, context.name)\n\t\t\tcase 'setter':\n\t\t\t\tif (!('setter' in description)) throw new Error('Decorator cannot be applied to a setter')\n\t\t\t\treturn description.setter!(target, context.name)\n\t\t\tcase 'method':\n\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\treturn description.method!(target, context.name)\n\t\t\tcase 'accessor': {\n\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\tconst rv: Partial<ClassAccessorDecoratorResult<any, any>> = {}\n\t\t\t\tif ('getter' in description) {\n\t\t\t\t\tconst newGetter = description.getter!(target.get, context.name)\n\t\t\t\t\tif (newGetter) rv.get = newGetter\n\t\t\t\t}\n\t\t\t\tif ('setter' in description) {\n\t\t\t\t\tconst newSetter = description.setter!(target.set, context.name)\n\t\t\t\t\tif (newSetter) rv.set = newSetter\n\t\t\t\t}\n\t\t\t\treturn rv\n\t\t\t}\n\t\t\t//return description.accessor?.(target, context.name, target)\n\t\t}\n\t}\n}\n\n/**\n * Detects if the decorator is being called in modern (Modern) or legacy (Legacy) mode\n * based on the arguments passed to the decorator function\n */\nfunction detectDecoratorMode(\n\t_target: any,\n\tcontextOrKey?: any,\n\t_descriptor?: any\n): 'modern' | 'legacy' {\n\t// Modern decorators have a context object as the second parameter\n\t// Legacy decorators have a string/symbol key as the second parameter\n\tif (\n\t\ttypeof contextOrKey === 'object' &&\n\t\tcontextOrKey !== null &&\n\t\ttypeof contextOrKey.kind === 'string'\n\t) {\n\t\treturn 'modern'\n\t}\n\treturn 'legacy'\n}\n\n/**\n * Main decorator factory that automatically detects and works with both Legacy and Modern decorator proposals\n * @param description - The decorator description object\n * @returns A decorator that works in both Legacy and Modern environments\n */\nexport const decorator: DecoratorFactory<any> = (description: DecoratorDescription<any>) => {\n\tconst modern = modernDecorator(description)\n\tconst legacy = legacyDecorator(description)\n\treturn ((target: any, contextOrKey?: any, ...args: any[]) => {\n\t\tconst mode = detectDecoratorMode(target, contextOrKey, args[0])\n\t\treturn mode === 'modern'\n\t\t\t? modern(target, contextOrKey, ...args)\n\t\t\t: legacy(target, contextOrKey, ...args)\n\t}) as any\n}\n\n/**\n * Generic class decorator type that works with both Legacy and Modern decorator proposals\n */\nexport type GenericClassDecorator<T> = LegacyClassDecorator<abstract new (...args: any[]) => T> &\n\tModernClassDecorator<abstract new (...args: any[]) => T>\n"],"names":[],"mappings":";;AAIA;;;;AAIG;AACG,SAAU,GAAG,CAAmC,GAAG,IAAO,EAAA;IAC/D,IAAI,CAAC,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,EAAE;IAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAsB,EAAE;AAEpC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE;AACnC,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAoB;AAC1D,QAAA,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;IACnB;AAEA,IAAA,OAAO,MAAM;AACd;AAEA;;;;;AAKG;AACG,SAAU,WAAW,CAAC,CAAM,EAAE,CAAM,EAAA;IACzC,IAAI,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,IAAI;AACxB,IAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AAAE,QAAA,OAAO,KAAK;AACxD,IAAA,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;AAAE,QAAA,OAAO,KAAK;AACvC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAClC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAAE,YAAA,OAAO,KAAK;IAChC;AACA,IAAA,OAA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EACpC;AACD,QAAA,OAAO,QAAQ;IAChB;AACA,IAAA,OAAO,QAAQ;AAChB;AAEA;;;;AAIG;AACI,MAAM,SAAS,GAA0B,CAAC,WAAsC,KAAI;AAC1F,IAAA,MAAM,MAAM,GAAG,eAAe,CAAC,WAAW,CAAC;AAC3C,IAAA,MAAM,MAAM,GAAG,eAAe,CAAC,WAAW,CAAC;IAC3C,QAAQ,CAAC,MAAW,EAAE,YAAkB,EAAE,GAAG,IAAW,KAAI;AAC3D,QAAA,MAAM,IAAI,GAAG,mBAAmB,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/D,OAAO,IAAI,KAAK;cACb,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI;cACpC,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;AACzC,IAAA,CAAC;AACF;;;;;;;;;;;;;;"}
|
|
@@ -14,6 +14,25 @@ function zip(...args) {
|
|
|
14
14
|
}
|
|
15
15
|
return result;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Checks if two arrays are strictly equal (shallow comparison)
|
|
19
|
+
* @param a - First value
|
|
20
|
+
* @param b - Second value
|
|
21
|
+
* @returns True if arrays are equal or values are strictly equal
|
|
22
|
+
*/
|
|
23
|
+
function arrayEquals(a, b) {
|
|
24
|
+
if (a === b)
|
|
25
|
+
return true;
|
|
26
|
+
if (!Array.isArray(a) || !Array.isArray(b))
|
|
27
|
+
return false;
|
|
28
|
+
if (a.length !== b.length)
|
|
29
|
+
return false;
|
|
30
|
+
for (let i = 0; i < a.length; i++) {
|
|
31
|
+
if (a[i] !== b[i])
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
17
36
|
const nativeConstructors = new Set([
|
|
18
37
|
Object,
|
|
19
38
|
Array,
|
|
@@ -71,7 +90,16 @@ function ReflectSet(obj, prop, value, receiver) {
|
|
|
71
90
|
// Check if Node is available and obj is an instance of Node
|
|
72
91
|
if (typeof Node !== 'undefined' && obj instanceof Node) {
|
|
73
92
|
obj[prop] = value;
|
|
74
|
-
return
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
if (!(obj instanceof Object) && !Reflect.has(obj, prop)) {
|
|
96
|
+
Object.defineProperty(obj, prop, {
|
|
97
|
+
value,
|
|
98
|
+
configurable: true,
|
|
99
|
+
writable: true,
|
|
100
|
+
enumerable: true,
|
|
101
|
+
});
|
|
102
|
+
return true;
|
|
75
103
|
}
|
|
76
104
|
return Reflect.set(obj, prop, value, receiver);
|
|
77
105
|
}
|
|
@@ -79,12 +107,6 @@ function isOwnAccessor(obj, prop) {
|
|
|
79
107
|
const opd = Object.getOwnPropertyDescriptor(obj, prop);
|
|
80
108
|
return !!(opd?.get || opd?.set);
|
|
81
109
|
}
|
|
82
|
-
/**
|
|
83
|
-
* Check if an object is an object (not null, not primitive)
|
|
84
|
-
*/
|
|
85
|
-
function isObject(obj) {
|
|
86
|
-
return obj !== null && typeof obj === 'object';
|
|
87
|
-
}
|
|
88
110
|
|
|
89
111
|
// biome-ignore-all lint/suspicious/noConfusingVoidType: We *love* voids
|
|
90
112
|
// Standardized decorator system that works with both Legacy and Modern decorators
|
|
@@ -108,7 +130,7 @@ function legacyDecorator(description) {
|
|
|
108
130
|
if (isConstructor(target)) {
|
|
109
131
|
if (!('class' in description))
|
|
110
132
|
throw new Error('Decorator cannot be applied to a class');
|
|
111
|
-
return description.class
|
|
133
|
+
return description.class(target);
|
|
112
134
|
}
|
|
113
135
|
}
|
|
114
136
|
else if (typeof target === 'object' && ['string', 'symbol'].includes(typeof propertyKey)) {
|
|
@@ -119,12 +141,12 @@ function legacyDecorator(description) {
|
|
|
119
141
|
if (!('getter' in description || 'setter' in description))
|
|
120
142
|
throw new Error('Decorator cannot be applied to a getter or setter');
|
|
121
143
|
if ('getter' in description) {
|
|
122
|
-
const newGetter = description.getter
|
|
144
|
+
const newGetter = description.getter(descriptor.get, propertyKey);
|
|
123
145
|
if (newGetter)
|
|
124
146
|
descriptor.get = newGetter;
|
|
125
147
|
}
|
|
126
148
|
if ('setter' in description) {
|
|
127
|
-
const newSetter = description.setter
|
|
149
|
+
const newSetter = description.setter(descriptor.set, propertyKey);
|
|
128
150
|
if (newSetter)
|
|
129
151
|
descriptor.set = newSetter;
|
|
130
152
|
}
|
|
@@ -133,7 +155,7 @@ function legacyDecorator(description) {
|
|
|
133
155
|
else if (typeof descriptor.value === 'function') {
|
|
134
156
|
if (!('method' in description))
|
|
135
157
|
throw new Error('Decorator cannot be applied to a method');
|
|
136
|
-
const newMethod = description.method
|
|
158
|
+
const newMethod = description.method(descriptor.value, propertyKey);
|
|
137
159
|
if (newMethod)
|
|
138
160
|
descriptor.value = newMethod;
|
|
139
161
|
return descriptor;
|
|
@@ -151,6 +173,7 @@ function legacyDecorator(description) {
|
|
|
151
173
|
* @returns A decorator function compatible with Modern decorators
|
|
152
174
|
*/
|
|
153
175
|
function modernDecorator(description) {
|
|
176
|
+
/*return function (target: any, context?: DecoratorContext, ...args: any[]) {*/
|
|
154
177
|
return function (target, context, ...args) {
|
|
155
178
|
if (!context?.kind || typeof context.kind !== 'string') {
|
|
156
179
|
if (!('default' in description))
|
|
@@ -161,32 +184,32 @@ function modernDecorator(description) {
|
|
|
161
184
|
case 'class':
|
|
162
185
|
if (!('class' in description))
|
|
163
186
|
throw new Error('Decorator cannot be applied to a class');
|
|
164
|
-
return description.class
|
|
187
|
+
return description.class(target);
|
|
165
188
|
case 'field':
|
|
166
189
|
throw new Error('Decorator cannot be applied to a field');
|
|
167
190
|
case 'getter':
|
|
168
191
|
if (!('getter' in description))
|
|
169
192
|
throw new Error('Decorator cannot be applied to a getter');
|
|
170
|
-
return description.getter
|
|
193
|
+
return description.getter(target, context.name);
|
|
171
194
|
case 'setter':
|
|
172
195
|
if (!('setter' in description))
|
|
173
196
|
throw new Error('Decorator cannot be applied to a setter');
|
|
174
|
-
return description.setter
|
|
197
|
+
return description.setter(target, context.name);
|
|
175
198
|
case 'method':
|
|
176
199
|
if (!('method' in description))
|
|
177
200
|
throw new Error('Decorator cannot be applied to a method');
|
|
178
|
-
return description.method
|
|
201
|
+
return description.method(target, context.name);
|
|
179
202
|
case 'accessor': {
|
|
180
203
|
if (!('getter' in description || 'setter' in description))
|
|
181
204
|
throw new Error('Decorator cannot be applied to a getter or setter');
|
|
182
205
|
const rv = {};
|
|
183
206
|
if ('getter' in description) {
|
|
184
|
-
const newGetter = description.getter
|
|
207
|
+
const newGetter = description.getter(target.get, context.name);
|
|
185
208
|
if (newGetter)
|
|
186
209
|
rv.get = newGetter;
|
|
187
210
|
}
|
|
188
211
|
if ('setter' in description) {
|
|
189
|
-
const newSetter = description.setter
|
|
212
|
+
const newSetter = description.setter(target.set, context.name);
|
|
190
213
|
if (newSetter)
|
|
191
214
|
rv.set = newSetter;
|
|
192
215
|
}
|
|
@@ -226,5 +249,5 @@ const decorator = (description) => {
|
|
|
226
249
|
});
|
|
227
250
|
};
|
|
228
251
|
|
|
229
|
-
export { DecoratorError as D, ReflectGet as R,
|
|
230
|
-
//# sourceMappingURL=decorator-
|
|
252
|
+
export { DecoratorError as D, ReflectGet as R, arrayEquals as a, ReflectSet as b, isOwnAccessor as c, decorator as d, isConstructor as i, legacyDecorator as l, modernDecorator as m, renamed as r, zip as z };
|
|
253
|
+
//# sourceMappingURL=decorator-DqiszP7i.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator-DqiszP7i.esm.js","sources":["../../src/utils.ts","../../src/decorator.ts"],"sourcesContent":["type ElementTypes<T extends readonly unknown[]> = {\n\t[K in keyof T]: T[K] extends readonly (infer U)[] ? U : T[K]\n}\n\n/**\n * Combines multiple arrays into an array of tuples, stopping at the shortest array length\n * @param args - Arrays to zip together\n * @returns Array of tuples containing elements from each input array\n */\nexport function zip<T extends (readonly unknown[])[]>(...args: T): ElementTypes<T>[] {\n\tif (!args.length) return []\n\tconst minLength = Math.min(...args.map((arr) => arr.length))\n\tconst result: ElementTypes<T>[] = []\n\n\tfor (let i = 0; i < minLength; i++) {\n\t\tconst tuple = args.map((arr) => arr[i]) as ElementTypes<T>\n\t\tresult.push(tuple)\n\t}\n\n\treturn result\n}\n\n/**\n * Checks if two arrays are strictly equal (shallow comparison)\n * @param a - First value\n * @param b - Second value\n * @returns True if arrays are equal or values are strictly equal\n */\nexport function arrayEquals(a: any, b: any): boolean {\n\tif (a === b) return true\n\tif (!Array.isArray(a) || !Array.isArray(b)) return false\n\tif (a.length !== b.length) return false\n\tfor (let i = 0; i < a.length; i++) {\n\t\tif (a[i] !== b[i]) return false\n\t}\n\treturn true\n}\n\nconst nativeConstructors = new Set<Function>([\n\tObject,\n\tArray,\n\tDate,\n\tFunction,\n\tSet,\n\tMap,\n\tWeakMap,\n\tWeakSet,\n\tPromise,\n\tError,\n\tTypeError,\n\tReferenceError,\n\tSyntaxError,\n\tRangeError,\n\tURIError,\n\tEvalError,\n\tReflect,\n\tProxy,\n\tRegExp,\n\tString,\n\tNumber,\n\tBoolean,\n] as Function[])\n/**\n * Checks if a function is a constructor (class or constructor function)\n * @param fn - The function to check\n * @returns True if the function is a constructor\n */\nexport function isConstructor(fn: Function): boolean {\n\treturn (\n\t\tfn &&\n\t\ttypeof fn === 'function' &&\n\t\t(nativeConstructors.has(fn) || fn.toString?.().startsWith('class '))\n\t)\n}\n\n/**\n * Renames a function with a new name\n * @param fct - The function to rename\n * @param name - The new name for the function\n * @returns The function with the new name\n */\nexport function renamed<F extends Function>(fct: F, name: string): F {\n\treturn Object.defineProperties(fct, {\n\t\tname: {\n\t\t\tvalue: name,\n\t\t},\n\t})\n}\n\nexport function ReflectGet(obj: any, prop: any, receiver: any) {\n\t// Check if Node is available and obj is an instance of Node\n\tif (typeof Node !== 'undefined' && obj instanceof Node) return (obj as any)[prop]\n\treturn Reflect.get(obj, prop, receiver)\n}\n\nexport function ReflectSet(obj: any, prop: any, value: any, receiver: any) {\n\t// Check if Node is available and obj is an instance of Node\n\tif (typeof Node !== 'undefined' && obj instanceof Node) {\n\t\t;(obj as any)[prop] = value\n\t\treturn true\n\t}\n\tif (!(obj instanceof Object) && !Reflect.has(obj, prop)) {\n\t\tObject.defineProperty(obj, prop, {\n\t\t\tvalue,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tenumerable: true,\n\t\t})\n\t\treturn true\n\t}\n\treturn Reflect.set(obj, prop, value, receiver)\n}\n\nexport function isOwnAccessor(obj: any, prop: any) {\n\tconst opd = Object.getOwnPropertyDescriptor(obj, prop)\n\treturn !!(opd?.get || opd?.set)\n}\n","// biome-ignore-all lint/suspicious/noConfusingVoidType: We *love* voids\n// Standardized decorator system that works with both Legacy and Modern decorators\n\nimport { isConstructor } from './utils'\n\n/**\n * Error thrown when decorator operations fail\n */\nexport class DecoratorError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'DecoratorException'\n\t}\n}\n//#region all decorator types\n\n// Used for get/set and method decorators\n/**\n * Legacy property decorator type for methods, getters, and setters\n */\nexport type LegacyPropertyDecorator<T> = (\n\ttarget: T,\n\tname: string | symbol,\n\tdescriptor: PropertyDescriptor\n) => any\n\n/**\n * Legacy class decorator type\n */\nexport type LegacyClassDecorator<T> = (target: T) => any\n\n/**\n * Modern method decorator type\n */\nexport type ModernMethodDecorator<T> = (target: T, context: ClassMethodDecoratorContext) => any\n\n/**\n * Modern getter decorator type\n */\nexport type ModernGetterDecorator<T> = (target: T, context: ClassGetterDecoratorContext) => any\n\n/**\n * Modern setter decorator type\n */\nexport type ModernSetterDecorator<T> = (target: T, context: ClassSetterDecoratorContext) => any\n\n/**\n * Modern accessor decorator type\n */\nexport type ModernAccessorDecorator<T> = (target: T, context: ClassAccessorDecoratorContext) => any\n\n/**\n * Modern class decorator type\n */\nexport type ModernClassDecorator<T> = (target: T, context: ClassDecoratorContext) => any\n\n//#endregion\n\ntype DDMethod<T> = (\n\toriginal: (this: T, ...args: any[]) => any,\n\tname: PropertyKey\n) => ((this: T, ...args: any[]) => any) | void\n\ntype DDGetter<T> = (original: (this: T) => any, name: PropertyKey) => ((this: T) => any) | void\n\ntype DDSetter<T> = (\n\toriginal: (this: T, value: any) => void,\n\tname: PropertyKey\n) => ((this: T, value: any) => void) | void\n\ntype DDClass<T> = <Ctor extends new (...args: any[]) => T = new (...args: any[]) => T>(\n\ttarget: Ctor\n) => Ctor | void\n/**\n * Description object for creating decorators that work with both Legacy and Modern decorator proposals\n */\nexport interface DecoratorDescription<T> {\n\t/** Handler for method decorators */\n\tmethod?: DDMethod<T>\n\t/** Handler for class decorators */\n\tclass?: DDClass<T>\n\t/** Handler for getter decorators */\n\tgetter?: DDGetter<T>\n\t/** Handler for setter decorators */\n\tsetter?: DDSetter<T>\n\t/** Default handler for any decorator type not explicitly defined */\n\tdefault?: (...args: any[]) => any\n}\n\n/**\n * Type for decorators that work with both Legacy and Modern decorator proposals\n * Automatically infers the correct decorator type based on the description\n */\nexport type Decorator<T, Description extends DecoratorDescription<T>> = (Description extends {\n\tmethod: DDMethod<T>\n}\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\n/**\n * Factory type for creating decorators that work with both Legacy and Modern decorator proposals\n */\nexport type DecoratorFactory<T> = <Description extends DecoratorDescription<T>>(\n\tdescription: Description\n) => (Description extends { method: DDMethod<T> }\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\n/**\n * Creates a decorator that works with Legacy decorator proposals\n * @param description - The decorator description object\n * @returns A decorator function compatible with Legacy decorators\n */\nexport function legacyDecorator<T = any>(description: DecoratorDescription<T>): any {\n\treturn function (\n\t\tthis: any,\n\t\ttarget: any,\n\t\tpropertyKey?: PropertyKey,\n\t\tdescriptor?: PropertyDescriptor,\n\t\t...args: any[]\n\t) {\n\t\tif (propertyKey === undefined) {\n\t\t\tif (isConstructor(target)) {\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class!(target)\n\t\t\t}\n\t\t} else if (typeof target === 'object' && ['string', 'symbol'].includes(typeof propertyKey)) {\n\t\t\tif (!descriptor) throw new Error('Decorator cannot be applied to a field')\n\t\t\telse if (typeof descriptor === 'object' && 'configurable' in descriptor) {\n\t\t\t\tif ('get' in descriptor || 'set' in descriptor) {\n\t\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\t\tif ('getter' in description) {\n\t\t\t\t\t\tconst newGetter = description.getter!(descriptor.get as any, propertyKey)\n\t\t\t\t\t\tif (newGetter) descriptor.get = newGetter\n\t\t\t\t\t}\n\t\t\t\t\tif ('setter' in description) {\n\t\t\t\t\t\tconst newSetter = description.setter!(descriptor.set as any, propertyKey)\n\t\t\t\t\t\tif (newSetter) descriptor.set = newSetter\n\t\t\t\t\t}\n\t\t\t\t\treturn descriptor\n\t\t\t\t} else if (typeof descriptor.value === 'function') {\n\t\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\t\tconst newMethod = description.method!(descriptor.value, propertyKey)\n\t\t\t\t\tif (newMethod) descriptor.value = newMethod\n\t\t\t\t\treturn descriptor\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!('default' in description))\n\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\treturn description.default!.call(this, target, propertyKey, descriptor, ...args)\n\t}\n}\n\n/**\n * Creates a decorator that works with Modern decorator proposals\n * @param description - The decorator description object\n * @returns A decorator function compatible with Modern decorators\n */\nexport function modernDecorator<T = any>(description: DecoratorDescription<T>): any {\n\t/*return function (target: any, context?: DecoratorContext, ...args: any[]) {*/\n\treturn function (this: any, target: any, context?: DecoratorContext, ...args: any[]) {\n\t\tif (!context?.kind || typeof context.kind !== 'string') {\n\t\t\tif (!('default' in description))\n\t\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\t\treturn description.default!.call(this, target, context, ...args)\n\t\t}\n\t\tswitch (context.kind) {\n\t\t\tcase 'class':\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class!(target)\n\t\t\tcase 'field':\n\t\t\t\tthrow new Error('Decorator cannot be applied to a field')\n\t\t\tcase 'getter':\n\t\t\t\tif (!('getter' in description)) throw new Error('Decorator cannot be applied to a getter')\n\t\t\t\treturn description.getter!(target, context.name)\n\t\t\tcase 'setter':\n\t\t\t\tif (!('setter' in description)) throw new Error('Decorator cannot be applied to a setter')\n\t\t\t\treturn description.setter!(target, context.name)\n\t\t\tcase 'method':\n\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\treturn description.method!(target, context.name)\n\t\t\tcase 'accessor': {\n\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\tconst rv: Partial<ClassAccessorDecoratorResult<any, any>> = {}\n\t\t\t\tif ('getter' in description) {\n\t\t\t\t\tconst newGetter = description.getter!(target.get, context.name)\n\t\t\t\t\tif (newGetter) rv.get = newGetter\n\t\t\t\t}\n\t\t\t\tif ('setter' in description) {\n\t\t\t\t\tconst newSetter = description.setter!(target.set, context.name)\n\t\t\t\t\tif (newSetter) rv.set = newSetter\n\t\t\t\t}\n\t\t\t\treturn rv\n\t\t\t}\n\t\t\t//return description.accessor?.(target, context.name, target)\n\t\t}\n\t}\n}\n\n/**\n * Detects if the decorator is being called in modern (Modern) or legacy (Legacy) mode\n * based on the arguments passed to the decorator function\n */\nfunction detectDecoratorMode(\n\t_target: any,\n\tcontextOrKey?: any,\n\t_descriptor?: any\n): 'modern' | 'legacy' {\n\t// Modern decorators have a context object as the second parameter\n\t// Legacy decorators have a string/symbol key as the second parameter\n\tif (\n\t\ttypeof contextOrKey === 'object' &&\n\t\tcontextOrKey !== null &&\n\t\ttypeof contextOrKey.kind === 'string'\n\t) {\n\t\treturn 'modern'\n\t}\n\treturn 'legacy'\n}\n\n/**\n * Main decorator factory that automatically detects and works with both Legacy and Modern decorator proposals\n * @param description - The decorator description object\n * @returns A decorator that works in both Legacy and Modern environments\n */\nexport const decorator: DecoratorFactory<any> = (description: DecoratorDescription<any>) => {\n\tconst modern = modernDecorator(description)\n\tconst legacy = legacyDecorator(description)\n\treturn ((target: any, contextOrKey?: any, ...args: any[]) => {\n\t\tconst mode = detectDecoratorMode(target, contextOrKey, args[0])\n\t\treturn mode === 'modern'\n\t\t\t? modern(target, contextOrKey, ...args)\n\t\t\t: legacy(target, contextOrKey, ...args)\n\t}) as any\n}\n\n/**\n * Generic class decorator type that works with both Legacy and Modern decorator proposals\n */\nexport type GenericClassDecorator<T> = LegacyClassDecorator<abstract new (...args: any[]) => T> &\n\tModernClassDecorator<abst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