mutts 1.0.4 → 1.0.6
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 +2 -1
- package/dist/chunks/{_tslib-Mzh1rNsX.esm.js → _tslib-MCKDzsSq.esm.js} +2 -2
- package/dist/chunks/_tslib-MCKDzsSq.esm.js.map +1 -0
- package/dist/chunks/decorator-BGILvPtN.esm.js +627 -0
- package/dist/chunks/decorator-BGILvPtN.esm.js.map +1 -0
- package/dist/chunks/decorator-BQ2eBTCj.js +651 -0
- package/dist/chunks/decorator-BQ2eBTCj.js.map +1 -0
- package/dist/chunks/{index-GRBSx0mB.js → index-CDCOjzTy.js} +543 -495
- package/dist/chunks/index-CDCOjzTy.js.map +1 -0
- package/dist/chunks/{index-79Kk8D6e.esm.js → index-DiP0RXoZ.esm.js} +452 -404
- package/dist/chunks/index-DiP0RXoZ.esm.js.map +1 -0
- package/dist/decorator.d.ts +3 -3
- package/dist/decorator.esm.js +1 -1
- package/dist/decorator.js +1 -1
- package/dist/destroyable.esm.js +4 -4
- package/dist/destroyable.esm.js.map +1 -1
- package/dist/destroyable.js +4 -4
- package/dist/destroyable.js.map +1 -1
- package/dist/devtools/panel.js.map +1 -1
- package/dist/eventful.esm.js +1 -1
- package/dist/index.esm.js +48 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +50 -4
- package/dist/index.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/reactive.d.ts +54 -1
- package/dist/reactive.esm.js +3 -3
- package/dist/reactive.js +6 -4
- package/dist/reactive.js.map +1 -1
- package/dist/std-decorators.d.ts +1 -1
- package/dist/std-decorators.esm.js +10 -10
- package/dist/std-decorators.esm.js.map +1 -1
- package/dist/std-decorators.js +10 -10
- package/dist/std-decorators.js.map +1 -1
- package/docs/ai/manual.md +14 -95
- package/docs/reactive/advanced.md +6 -107
- package/docs/reactive/core.md +16 -16
- package/docs/reactive/debugging.md +158 -0
- package/docs/reactive.md +8 -0
- package/package.json +16 -66
- package/src/decorator.ts +11 -9
- package/src/destroyable.ts +5 -5
- package/src/index.ts +46 -0
- package/src/reactive/array.ts +3 -5
- package/src/reactive/change.ts +7 -3
- package/src/reactive/debug.ts +1 -1
- package/src/reactive/deep-touch.ts +1 -1
- package/src/reactive/deep-watch.ts +1 -1
- package/src/reactive/effect-context.ts +2 -2
- package/src/reactive/effects.ts +114 -17
- package/src/reactive/index.ts +3 -2
- package/src/reactive/interface.ts +10 -9
- package/src/reactive/map.ts +6 -6
- package/src/reactive/mapped.ts +2 -3
- package/src/reactive/memoize.ts +77 -31
- package/src/reactive/project.ts +103 -6
- package/src/reactive/proxy.ts +4 -4
- package/src/reactive/registry.ts +67 -0
- package/src/reactive/set.ts +6 -6
- package/src/reactive/tracking.ts +12 -41
- package/src/reactive/types.ts +59 -0
- package/src/reactive/zone.ts +1 -1
- package/src/std-decorators.ts +10 -10
- package/src/utils.ts +141 -0
- package/dist/chunks/_tslib-Mzh1rNsX.esm.js.map +0 -1
- package/dist/chunks/decorator-DLvrD0UF.js +0 -265
- package/dist/chunks/decorator-DLvrD0UF.js.map +0 -1
- package/dist/chunks/decorator-DqiszP7i.esm.js +0 -253
- package/dist/chunks/decorator-DqiszP7i.esm.js.map +0 -1
- package/dist/chunks/index-79Kk8D6e.esm.js.map +0 -1
- package/dist/chunks/index-GRBSx0mB.js.map +0 -1
- /package/{src/reactive/project.project.md → docs/reactive/project.md} +0 -0
package/src/utils.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { prototypeForwarding } from './reactive/types'
|
|
2
|
+
|
|
1
3
|
type ElementTypes<T extends readonly unknown[]> = {
|
|
2
4
|
[K in keyof T]: T[K] extends readonly (infer U)[] ? U : T[K]
|
|
3
5
|
}
|
|
@@ -115,3 +117,142 @@ export function isOwnAccessor(obj: any, prop: any) {
|
|
|
115
117
|
const opd = Object.getOwnPropertyDescriptor(obj, prop)
|
|
116
118
|
return !!(opd?.get || opd?.set)
|
|
117
119
|
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Deeply compares two values.
|
|
123
|
+
* For objects, compares prototypes with === and then own properties recursively.
|
|
124
|
+
* Uses a cache to handle circular references.
|
|
125
|
+
* @param a - First value
|
|
126
|
+
* @param b - Second value
|
|
127
|
+
* @param cache - Map for circular reference protection (internal use)
|
|
128
|
+
* @returns True if values are deeply equal
|
|
129
|
+
*/
|
|
130
|
+
export function deepCompare(a: any, b: any, cache = new Map<object, Set<object>>()): boolean {
|
|
131
|
+
// Unwrap mutts proxies if present
|
|
132
|
+
while (a && typeof a === 'object' && prototypeForwarding in a) {
|
|
133
|
+
a = (a as any)[prototypeForwarding]
|
|
134
|
+
}
|
|
135
|
+
while (b && typeof b === 'object' && prototypeForwarding in b) {
|
|
136
|
+
b = (b as any)[prototypeForwarding]
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (a === b) return true
|
|
140
|
+
|
|
141
|
+
if (typeof a !== 'object' || a === null || typeof b !== 'object' || b === null) {
|
|
142
|
+
return a === b
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Prototype check
|
|
146
|
+
const protoA = Object.getPrototypeOf(a)
|
|
147
|
+
const protoB = Object.getPrototypeOf(b)
|
|
148
|
+
if (protoA !== protoB) {
|
|
149
|
+
console.warn(`[deepCompare] prototype mismatch:`, { nameA: a?.constructor?.name, nameB: b?.constructor?.name })
|
|
150
|
+
return false
|
|
151
|
+
}
|
|
152
|
+
// Circular reference protection
|
|
153
|
+
let compared = cache.get(a)
|
|
154
|
+
if (compared?.has(b)) return true
|
|
155
|
+
if (!compared) {
|
|
156
|
+
compared = new Set()
|
|
157
|
+
cache.set(a, compared)
|
|
158
|
+
}
|
|
159
|
+
compared.add(b)
|
|
160
|
+
|
|
161
|
+
// Handle specific object types
|
|
162
|
+
if (Array.isArray(a)) {
|
|
163
|
+
if (!Array.isArray(b)) {
|
|
164
|
+
console.warn(`[deepCompare] B is not an array`)
|
|
165
|
+
return false
|
|
166
|
+
}
|
|
167
|
+
if (a.length !== b.length) {
|
|
168
|
+
console.warn(`[deepCompare] array length mismatch:`, { lenA: a.length, lenB: b.length })
|
|
169
|
+
return false
|
|
170
|
+
}
|
|
171
|
+
for (let i = 0; i < a.length; i++) {
|
|
172
|
+
if (!deepCompare(a[i], b[i], cache)) {
|
|
173
|
+
console.warn(`[deepCompare] array element mismatch at index ${i}`)
|
|
174
|
+
return false
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return true
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (a instanceof Date) {
|
|
181
|
+
const match = b instanceof Date && a.getTime() === b.getTime()
|
|
182
|
+
if (!match) console.warn(`[deepCompare] Date mismatch`)
|
|
183
|
+
return match
|
|
184
|
+
}
|
|
185
|
+
if (a instanceof RegExp) {
|
|
186
|
+
const match = b instanceof RegExp && a.toString() === b.toString()
|
|
187
|
+
if (!match) console.warn(`[deepCompare] RegExp mismatch`)
|
|
188
|
+
return match
|
|
189
|
+
}
|
|
190
|
+
if (a instanceof Set) {
|
|
191
|
+
if (!(b instanceof Set) || a.size !== b.size) {
|
|
192
|
+
console.warn(`[deepCompare] Set size mismatch`)
|
|
193
|
+
return false
|
|
194
|
+
}
|
|
195
|
+
for (const val of a) {
|
|
196
|
+
let found = false
|
|
197
|
+
for (const bVal of b) {
|
|
198
|
+
if (deepCompare(val, bVal, cache)) {
|
|
199
|
+
found = true
|
|
200
|
+
break
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (!found) {
|
|
204
|
+
console.warn(`[deepCompare] missing Set element`)
|
|
205
|
+
return false
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return true
|
|
209
|
+
}
|
|
210
|
+
if (a instanceof Map) {
|
|
211
|
+
if (!(b instanceof Map) || a.size !== b.size) {
|
|
212
|
+
console.warn(`[deepCompare] Map size mismatch`)
|
|
213
|
+
return false
|
|
214
|
+
}
|
|
215
|
+
for (const [key, val] of a) {
|
|
216
|
+
if (!b.has(key)) {
|
|
217
|
+
let foundMatch = false
|
|
218
|
+
for (const [bKey, bVal] of b) {
|
|
219
|
+
if (deepCompare(key, bKey, cache) && deepCompare(val, bVal, cache)) {
|
|
220
|
+
foundMatch = true
|
|
221
|
+
break
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (!foundMatch) {
|
|
225
|
+
console.warn(`[deepCompare] missing Map key`)
|
|
226
|
+
return false
|
|
227
|
+
}
|
|
228
|
+
} else {
|
|
229
|
+
if (!deepCompare(val, b.get(key), cache)) {
|
|
230
|
+
console.warn(`[deepCompare] Map value mismatch for key`)
|
|
231
|
+
return false
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return true
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Compare own properties
|
|
239
|
+
const keysA = Object.keys(a)
|
|
240
|
+
const keysB = Object.keys(b)
|
|
241
|
+
if (keysA.length !== keysB.length) {
|
|
242
|
+
console.warn(`[deepCompare] keys length mismatch:`, { lenA: keysA.length, lenB: keysB.length, keysA, keysB, a, b })
|
|
243
|
+
return false
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
for (const key of keysA) {
|
|
247
|
+
if (!Object.prototype.hasOwnProperty.call(b, key)) {
|
|
248
|
+
console.warn(`[deepCompare] missing key ${String(key)} in B`)
|
|
249
|
+
return false
|
|
250
|
+
}
|
|
251
|
+
if (!deepCompare(a[key], b[key], cache)) {
|
|
252
|
+
console.warn(`[deepCompare] value mismatch for key ${String(key)}:`, { valA: a[key], valB: b[key] })
|
|
253
|
+
return false
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return true
|
|
258
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_tslib-Mzh1rNsX.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Combines multiple arrays into an array of tuples, stopping at the shortest array length
|
|
5
|
-
* @param args - Arrays to zip together
|
|
6
|
-
* @returns Array of tuples containing elements from each input array
|
|
7
|
-
*/
|
|
8
|
-
function zip(...args) {
|
|
9
|
-
if (!args.length)
|
|
10
|
-
return [];
|
|
11
|
-
const minLength = Math.min(...args.map((arr) => arr.length));
|
|
12
|
-
const result = [];
|
|
13
|
-
for (let i = 0; i < minLength; i++) {
|
|
14
|
-
const tuple = args.map((arr) => arr[i]);
|
|
15
|
-
result.push(tuple);
|
|
16
|
-
}
|
|
17
|
-
return result;
|
|
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
|
-
}
|
|
38
|
-
const nativeConstructors = new Set([
|
|
39
|
-
Object,
|
|
40
|
-
Array,
|
|
41
|
-
Date,
|
|
42
|
-
Function,
|
|
43
|
-
Set,
|
|
44
|
-
Map,
|
|
45
|
-
WeakMap,
|
|
46
|
-
WeakSet,
|
|
47
|
-
Promise,
|
|
48
|
-
Error,
|
|
49
|
-
TypeError,
|
|
50
|
-
ReferenceError,
|
|
51
|
-
SyntaxError,
|
|
52
|
-
RangeError,
|
|
53
|
-
URIError,
|
|
54
|
-
EvalError,
|
|
55
|
-
Reflect,
|
|
56
|
-
Proxy,
|
|
57
|
-
RegExp,
|
|
58
|
-
String,
|
|
59
|
-
Number,
|
|
60
|
-
Boolean,
|
|
61
|
-
]);
|
|
62
|
-
/**
|
|
63
|
-
* Checks if a function is a constructor (class or constructor function)
|
|
64
|
-
* @param fn - The function to check
|
|
65
|
-
* @returns True if the function is a constructor
|
|
66
|
-
*/
|
|
67
|
-
function isConstructor(fn) {
|
|
68
|
-
return (fn &&
|
|
69
|
-
typeof fn === 'function' &&
|
|
70
|
-
(nativeConstructors.has(fn) || fn.toString?.().startsWith('class ')));
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Renames a function with a new name
|
|
74
|
-
* @param fct - The function to rename
|
|
75
|
-
* @param name - The new name for the function
|
|
76
|
-
* @returns The function with the new name
|
|
77
|
-
*/
|
|
78
|
-
function renamed(fct, name) {
|
|
79
|
-
return Object.defineProperties(fct, {
|
|
80
|
-
name: {
|
|
81
|
-
value: name,
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function ReflectGet(obj, prop, receiver) {
|
|
86
|
-
// Check if Node is available and obj is an instance of Node
|
|
87
|
-
if (typeof Node !== 'undefined' && obj instanceof Node)
|
|
88
|
-
return obj[prop];
|
|
89
|
-
return Reflect.get(obj, prop, receiver);
|
|
90
|
-
}
|
|
91
|
-
function ReflectSet(obj, prop, value, receiver) {
|
|
92
|
-
// Check if Node is available and obj is an instance of Node
|
|
93
|
-
if (typeof Node !== 'undefined' && obj instanceof Node) {
|
|
94
|
-
obj[prop] = value;
|
|
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;
|
|
105
|
-
}
|
|
106
|
-
return Reflect.set(obj, prop, value, receiver);
|
|
107
|
-
}
|
|
108
|
-
function isOwnAccessor(obj, prop) {
|
|
109
|
-
const opd = Object.getOwnPropertyDescriptor(obj, prop);
|
|
110
|
-
return !!(opd?.get || opd?.set);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// biome-ignore-all lint/suspicious/noConfusingVoidType: We *love* voids
|
|
114
|
-
// Standardized decorator system that works with both Legacy and Modern decorators
|
|
115
|
-
/**
|
|
116
|
-
* Error thrown when decorator operations fail
|
|
117
|
-
*/
|
|
118
|
-
class DecoratorError extends Error {
|
|
119
|
-
constructor(message) {
|
|
120
|
-
super(message);
|
|
121
|
-
this.name = 'DecoratorException';
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Creates a decorator that works with Legacy decorator proposals
|
|
126
|
-
* @param description - The decorator description object
|
|
127
|
-
* @returns A decorator function compatible with Legacy decorators
|
|
128
|
-
*/
|
|
129
|
-
function legacyDecorator(description) {
|
|
130
|
-
return function (target, propertyKey, descriptor, ...args) {
|
|
131
|
-
if (propertyKey === undefined) {
|
|
132
|
-
if (isConstructor(target)) {
|
|
133
|
-
if (!('class' in description))
|
|
134
|
-
throw new Error('Decorator cannot be applied to a class');
|
|
135
|
-
return description.class(target);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
else if (typeof target === 'object' && ['string', 'symbol'].includes(typeof propertyKey)) {
|
|
139
|
-
if (!descriptor)
|
|
140
|
-
throw new Error('Decorator cannot be applied to a field');
|
|
141
|
-
else if (typeof descriptor === 'object' && 'configurable' in descriptor) {
|
|
142
|
-
if ('get' in descriptor || 'set' in descriptor) {
|
|
143
|
-
if (!('getter' in description || 'setter' in description))
|
|
144
|
-
throw new Error('Decorator cannot be applied to a getter or setter');
|
|
145
|
-
if ('getter' in description) {
|
|
146
|
-
const newGetter = description.getter(descriptor.get, propertyKey);
|
|
147
|
-
if (newGetter)
|
|
148
|
-
descriptor.get = newGetter;
|
|
149
|
-
}
|
|
150
|
-
if ('setter' in description) {
|
|
151
|
-
const newSetter = description.setter(descriptor.set, propertyKey);
|
|
152
|
-
if (newSetter)
|
|
153
|
-
descriptor.set = newSetter;
|
|
154
|
-
}
|
|
155
|
-
return descriptor;
|
|
156
|
-
}
|
|
157
|
-
else if (typeof descriptor.value === 'function') {
|
|
158
|
-
if (!('method' in description))
|
|
159
|
-
throw new Error('Decorator cannot be applied to a method');
|
|
160
|
-
const newMethod = description.method(descriptor.value, propertyKey);
|
|
161
|
-
if (newMethod)
|
|
162
|
-
descriptor.value = newMethod;
|
|
163
|
-
return descriptor;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
if (!('default' in description))
|
|
168
|
-
throw new Error('Decorator do not have a default implementation');
|
|
169
|
-
return description.default.call(this, target, propertyKey, descriptor, ...args);
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Creates a decorator that works with Modern decorator proposals
|
|
174
|
-
* @param description - The decorator description object
|
|
175
|
-
* @returns A decorator function compatible with Modern decorators
|
|
176
|
-
*/
|
|
177
|
-
function modernDecorator(description) {
|
|
178
|
-
/*return function (target: any, context?: DecoratorContext, ...args: any[]) {*/
|
|
179
|
-
return function (target, context, ...args) {
|
|
180
|
-
if (!context?.kind || typeof context.kind !== 'string') {
|
|
181
|
-
if (!('default' in description))
|
|
182
|
-
throw new Error('Decorator do not have a default implementation');
|
|
183
|
-
return description.default.call(this, target, context, ...args);
|
|
184
|
-
}
|
|
185
|
-
switch (context.kind) {
|
|
186
|
-
case 'class':
|
|
187
|
-
if (!('class' in description))
|
|
188
|
-
throw new Error('Decorator cannot be applied to a class');
|
|
189
|
-
return description.class(target);
|
|
190
|
-
case 'field':
|
|
191
|
-
throw new Error('Decorator cannot be applied to a field');
|
|
192
|
-
case 'getter':
|
|
193
|
-
if (!('getter' in description))
|
|
194
|
-
throw new Error('Decorator cannot be applied to a getter');
|
|
195
|
-
return description.getter(target, context.name);
|
|
196
|
-
case 'setter':
|
|
197
|
-
if (!('setter' in description))
|
|
198
|
-
throw new Error('Decorator cannot be applied to a setter');
|
|
199
|
-
return description.setter(target, context.name);
|
|
200
|
-
case 'method':
|
|
201
|
-
if (!('method' in description))
|
|
202
|
-
throw new Error('Decorator cannot be applied to a method');
|
|
203
|
-
return description.method(target, context.name);
|
|
204
|
-
case 'accessor': {
|
|
205
|
-
if (!('getter' in description || 'setter' in description))
|
|
206
|
-
throw new Error('Decorator cannot be applied to a getter or setter');
|
|
207
|
-
const rv = {};
|
|
208
|
-
if ('getter' in description) {
|
|
209
|
-
const newGetter = description.getter(target.get, context.name);
|
|
210
|
-
if (newGetter)
|
|
211
|
-
rv.get = newGetter;
|
|
212
|
-
}
|
|
213
|
-
if ('setter' in description) {
|
|
214
|
-
const newSetter = description.setter(target.set, context.name);
|
|
215
|
-
if (newSetter)
|
|
216
|
-
rv.set = newSetter;
|
|
217
|
-
}
|
|
218
|
-
return rv;
|
|
219
|
-
}
|
|
220
|
-
//return description.accessor?.(target, context.name, target)
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Detects if the decorator is being called in modern (Modern) or legacy (Legacy) mode
|
|
226
|
-
* based on the arguments passed to the decorator function
|
|
227
|
-
*/
|
|
228
|
-
function detectDecoratorMode(_target, contextOrKey, _descriptor) {
|
|
229
|
-
// Modern decorators have a context object as the second parameter
|
|
230
|
-
// Legacy decorators have a string/symbol key as the second parameter
|
|
231
|
-
if (typeof contextOrKey === 'object' &&
|
|
232
|
-
contextOrKey !== null &&
|
|
233
|
-
typeof contextOrKey.kind === 'string') {
|
|
234
|
-
return 'modern';
|
|
235
|
-
}
|
|
236
|
-
return 'legacy';
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Main decorator factory that automatically detects and works with both Legacy and Modern decorator proposals
|
|
240
|
-
* @param description - The decorator description object
|
|
241
|
-
* @returns A decorator that works in both Legacy and Modern environments
|
|
242
|
-
*/
|
|
243
|
-
const decorator = (description) => {
|
|
244
|
-
const modern = modernDecorator(description);
|
|
245
|
-
const legacy = legacyDecorator(description);
|
|
246
|
-
return ((target, contextOrKey, ...args) => {
|
|
247
|
-
const mode = detectDecoratorMode(target, contextOrKey, args[0]);
|
|
248
|
-
return mode === 'modern'
|
|
249
|
-
? modern(target, contextOrKey, ...args)
|
|
250
|
-
: legacy(target, contextOrKey, ...args);
|
|
251
|
-
});
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
exports.DecoratorError = DecoratorError;
|
|
255
|
-
exports.ReflectGet = ReflectGet;
|
|
256
|
-
exports.ReflectSet = ReflectSet;
|
|
257
|
-
exports.arrayEquals = arrayEquals;
|
|
258
|
-
exports.decorator = decorator;
|
|
259
|
-
exports.isConstructor = isConstructor;
|
|
260
|
-
exports.isOwnAccessor = isOwnAccessor;
|
|
261
|
-
exports.legacyDecorator = legacyDecorator;
|
|
262
|
-
exports.modernDecorator = modernDecorator;
|
|
263
|
-
exports.renamed = renamed;
|
|
264
|
-
exports.zip = zip;
|
|
265
|
-
//# sourceMappingURL=decorator-DLvrD0UF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAC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