ivue 1.6.1 → 2.0.0
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 +171 -33
- package/bin/ivue.mjs +152 -0
- package/dist/Reactive.d.ts +131 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +88 -206
- package/dist/index.umd.js +1 -1
- package/lib/Reactive.ts +285 -114
- package/lib/__tests__/Reactive.vitest.spec.ts +1056 -0
- package/lib/__tests__/ReactiveAdversarial.vitest.spec.ts +182 -0
- package/lib/__tests__/coverage-completion.vitest.spec.ts +24 -0
- package/lib/__tests__/ivue.vitest.spec.ts +76 -19
- package/lib/index.ts +1 -2
- package/package.json +39 -10
- package/skills/ivue/SKILL.md +726 -0
- package/dist/ivue.d.ts +0 -310
package/dist/index.es.js
CHANGED
|
@@ -1,215 +1,97 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
if (
|
|
6
|
-
return
|
|
7
|
-
const
|
|
1
|
+
import { effectScope as h, watch as w, watchEffect as O, toRaw as g, isRef as j } from "vue";
|
|
2
|
+
const m = Object.hasOwn, b = Object.getPrototypeOf, d = Object.getOwnPropertyDescriptor, S = Object.getOwnPropertyNames, a = Object.defineProperty, v = Object.prototype, p = Symbol.for("ivue.raw"), l = Symbol.for("ivue.scope"), y = Symbol.for("ivue.processed");
|
|
3
|
+
function f(e) {
|
|
4
|
+
const r = g(e);
|
|
5
|
+
if (r !== e)
|
|
6
|
+
return r[p] ?? (r[p] = r);
|
|
7
|
+
const n = e[p];
|
|
8
|
+
return n ? n === e ? n : g(n) : e[p] = e;
|
|
9
|
+
}
|
|
10
|
+
function $(e, r, n, o) {
|
|
11
|
+
a(e, r, { configurable: !0, enumerable: !1, get() {
|
|
12
|
+
const t = f(this);
|
|
13
|
+
return t[n] ?? (t[n] = o.bind(t));
|
|
14
|
+
}, set(t) {
|
|
15
|
+
f(this)[n] = t;
|
|
16
|
+
} });
|
|
17
|
+
}
|
|
18
|
+
function E(e, r, n, o, t) {
|
|
19
|
+
const s = r[0] === "$";
|
|
20
|
+
a(e, r, { configurable: !0, enumerable: !1, get: function() {
|
|
21
|
+
const c = f(this);
|
|
22
|
+
if (n in c)
|
|
23
|
+
return c[n];
|
|
24
|
+
const u = o.call(c);
|
|
25
|
+
return s ? (c[n] = u, u) : (j(u) ? c[n] = u : a(e, r, { configurable: !0, enumerable: !1, get() {
|
|
26
|
+
return o.call(f(this));
|
|
27
|
+
}, set: t ? function(i) {
|
|
28
|
+
return t.call(f(this), i);
|
|
29
|
+
} : void 0 }), u);
|
|
30
|
+
}, set: t ? function(c) {
|
|
31
|
+
return t.call(f(this), c);
|
|
32
|
+
} : void 0 });
|
|
33
|
+
}
|
|
34
|
+
function C(e) {
|
|
35
|
+
const r = [];
|
|
8
36
|
let n = e.prototype;
|
|
9
|
-
for (; n && n !==
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
37
|
+
for (; n && n !== v; )
|
|
38
|
+
r.push(n), n = b(n);
|
|
39
|
+
r.reverse();
|
|
40
|
+
for (const o of r) {
|
|
41
|
+
if (m(o, y))
|
|
42
|
+
continue;
|
|
43
|
+
const t = S(o), s = [];
|
|
44
|
+
for (const c of t) {
|
|
45
|
+
if (c === "constructor")
|
|
13
46
|
continue;
|
|
14
|
-
const
|
|
15
|
-
|
|
47
|
+
const u = d(o, c);
|
|
48
|
+
if (typeof u.value == "function") {
|
|
49
|
+
const i = Symbol(c);
|
|
50
|
+
s.push(i), $(o, c, i, u.value);
|
|
51
|
+
} else if (u.get) {
|
|
52
|
+
const i = Symbol(c);
|
|
53
|
+
s.push(i), E(o, c, i, u.get, u.set);
|
|
54
|
+
}
|
|
16
55
|
}
|
|
17
|
-
|
|
56
|
+
a(o, y, { value: s });
|
|
18
57
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var f, g, b;
|
|
40
|
-
const { accessors: o, methods: n } = A(e), c = o != null && o.size ? M(null) : null, t = _(new e(...s));
|
|
41
|
-
for (const [i, u] of o)
|
|
42
|
-
p(t, i, { get: () => {
|
|
43
|
-
var y, m;
|
|
44
|
-
return c[i] ?? (c[i] = j({ get: (y = u.get) == null ? void 0 : y.bind(t), set: (m = u.set) == null ? void 0 : m.bind(t) }));
|
|
45
|
-
}, enumerable: u.enumerable, configurable: u.configurable });
|
|
46
|
-
const a = e == null ? void 0 : e.ivueDisableReactivity;
|
|
47
|
-
if (a)
|
|
48
|
-
for (const i of a) {
|
|
49
|
-
const u = o.get(i);
|
|
50
|
-
u ? p(t, i, { get: (f = u.get) == null ? void 0 : f.bind(t), set: (g = u.set) == null ? void 0 : g.bind(t), enumerable: u.enumerable, configurable: u.configurable }) : (console.log("des criptor", i, u), t[i] = x(t[i]));
|
|
51
|
-
}
|
|
52
|
-
const r = { writable: !0, configurable: !0, enumerable: !1 };
|
|
53
|
-
for (const i of n)
|
|
54
|
-
r.value = t[i].bind(t), p(t, i, r);
|
|
55
|
-
return p(t, "toRefs", { get: (() => {
|
|
56
|
-
let i = null;
|
|
57
|
-
return () => i ?? (i = N(t, o, c));
|
|
58
|
-
})(), enumerable: !1 }), p(t, "clone", { value: (...i) => V(e, s, t, o, n, i), enumerable: !1 }), p(t, R, { value: !0, enumerable: !1, configurable: !1, writable: !1 }), (b = t == null ? void 0 : t.init) == null || b.call(t, !1), t;
|
|
59
|
-
}, V = (e, s, o, n, c, t = []) => {
|
|
60
|
-
var y, m, S;
|
|
61
|
-
const a = n != null && n.size ? M(null) : null, r = _(new e(...s)), { onlyProps: f } = k(r), g = e.ivueCloneByReference, b = P.get(e);
|
|
62
|
-
if (g)
|
|
63
|
-
for (const l of f)
|
|
64
|
-
r[l] = g.has(l) ? o[l] : d(o[l], b);
|
|
65
|
-
else
|
|
66
|
-
for (const l of f)
|
|
67
|
-
r[l] = d(o[l], b);
|
|
68
|
-
for (const [l, w] of n)
|
|
69
|
-
p(r, l, { get: () => {
|
|
70
|
-
var W, C;
|
|
71
|
-
return a[l] ?? (a[l] = j({ get: (W = w.get) == null ? void 0 : W.bind(r), set: (C = w.set) == null ? void 0 : C.bind(r) }));
|
|
72
|
-
}, enumerable: w.enumerable, configurable: w.configurable });
|
|
73
|
-
const i = e == null ? void 0 : e.ivueDisableReactivity;
|
|
74
|
-
if (i)
|
|
75
|
-
for (const l of i) {
|
|
76
|
-
const w = n.get(l);
|
|
77
|
-
w ? p(r, l, { get: (y = w.get) == null ? void 0 : y.bind(r), set: (m = w.set) == null ? void 0 : m.bind(r), enumerable: w.enumerable, configurable: w.configurable }) : r[l] = x(r[l]);
|
|
78
|
-
}
|
|
79
|
-
const u = { writable: !0, configurable: !0, enumerable: !1 };
|
|
80
|
-
for (const l of c)
|
|
81
|
-
u.value = r[l].bind(r), p(r, l, u);
|
|
82
|
-
return p(r, "toRefs", { get: (() => {
|
|
83
|
-
let l = null;
|
|
84
|
-
return () => l ?? (l = N(r, n, a));
|
|
85
|
-
})(), enumerable: !1 }), p(r, "clone", { value: (...l) => V(e, s, r, n, c, l), enumerable: !1 }), p(r, R, { value: !0, enumerable: !1, configurable: !1, writable: !1 }), (S = r == null ? void 0 : r.init) == null || S.call(r, !0, ...t), r;
|
|
86
|
-
}, H = B, J = T, Q = (e) => e, N = (e, s, o) => {
|
|
87
|
-
const n = s.get.bind(s), { allProps: c } = k(e);
|
|
88
|
-
return function(t = !1, a) {
|
|
89
|
-
const r = {};
|
|
90
|
-
if (I(t))
|
|
91
|
-
for (const f of t) {
|
|
92
|
-
const g = c.get(f);
|
|
93
|
-
E(r, f, g, e, n, o);
|
|
58
|
+
return m(e.prototype, "$stopEffects") || (a(e.prototype, "$watch", { enumerable: !1, configurable: !0, writable: !0, value: function(...o) {
|
|
59
|
+
const t = f(this);
|
|
60
|
+
return (t[l] ?? (t[l] = h(!0))).run(() => w(...o));
|
|
61
|
+
} }), a(e.prototype, "$watchEffect", { enumerable: !1, configurable: !0, writable: !0, value: function(...o) {
|
|
62
|
+
const t = f(this);
|
|
63
|
+
return (t[l] ?? (t[l] = h(!0))).run(() => O(...o));
|
|
64
|
+
} }), a(e.prototype, "$stopEffects", { enumerable: !1, configurable: !0, writable: !0, value: function() {
|
|
65
|
+
const o = f(this);
|
|
66
|
+
try {
|
|
67
|
+
const t = o[l];
|
|
68
|
+
t && t.stop();
|
|
69
|
+
} finally {
|
|
70
|
+
delete o[l];
|
|
71
|
+
let t = b(o);
|
|
72
|
+
for (; t && t !== v; ) {
|
|
73
|
+
const s = t[y];
|
|
74
|
+
if (s)
|
|
75
|
+
for (const c of s)
|
|
76
|
+
delete o[c];
|
|
77
|
+
t = b(t);
|
|
94
78
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
o === 0 && (e[s] = z(n, s));
|
|
107
|
-
}, K = (e) => {
|
|
108
|
-
var s;
|
|
109
|
-
return typeof e == "function" && !!e.prototype && !((s = U(e, "prototype")) != null && s.writable);
|
|
110
|
-
}, X = (e, s, o = void 0) => {
|
|
111
|
-
for (const n in s) {
|
|
112
|
-
const c = e == null ? void 0 : e[n];
|
|
113
|
-
s[n].required || c !== void 0 && (typeof c == "object" && c !== null ? s[n].default = () => d(c, o) : K(c) ? s[n].default = () => c : s[n].default = c);
|
|
114
|
-
}
|
|
115
|
-
return s;
|
|
116
|
-
}, O = (e, s, o, n) => {
|
|
117
|
-
const c = Object.getOwnPropertyDescriptors(e);
|
|
118
|
-
for (const t of Reflect.ownKeys(c)) {
|
|
119
|
-
const a = c[t];
|
|
120
|
-
"value" in a && (a.value = d(a.value, o, n)), Object.defineProperty(s, t, a);
|
|
79
|
+
}
|
|
80
|
+
} })), e;
|
|
81
|
+
}
|
|
82
|
+
const P = (e) => {
|
|
83
|
+
var r;
|
|
84
|
+
return typeof e == "function" && !!e.prototype && !((r = d(e, "prototype")) != null && r.writable);
|
|
85
|
+
}, D = (e, r, n) => {
|
|
86
|
+
const o = {};
|
|
87
|
+
for (const t in r) {
|
|
88
|
+
const s = e == null ? void 0 : e[t], c = r[t];
|
|
89
|
+
o[t] = { ...c }, c.required || s === void 0 || (typeof s == "object" && s !== null ? o[t].default = () => n ? n(s) : structuredClone(s) : P(s) ? o[t].default = () => s : o[t].default = s);
|
|
121
90
|
}
|
|
91
|
+
return o;
|
|
122
92
|
};
|
|
123
|
-
let P = /* @__PURE__ */ new WeakMap();
|
|
124
|
-
const d = (e, s, o = /* @__PURE__ */ new WeakMap()) => {
|
|
125
|
-
if (e == null || typeof e != "object")
|
|
126
|
-
return e;
|
|
127
|
-
if (o.has(e))
|
|
128
|
-
return o.get(e);
|
|
129
|
-
if (I(e)) {
|
|
130
|
-
const t = e.length, a = new Array(t);
|
|
131
|
-
o.set(e, a);
|
|
132
|
-
for (let r = 0; r < t; r++)
|
|
133
|
-
a[r] = d(e[r], s, o);
|
|
134
|
-
return a;
|
|
135
|
-
}
|
|
136
|
-
const n = D(e);
|
|
137
|
-
if (n === Object.prototype || n === null) {
|
|
138
|
-
const t = M(n);
|
|
139
|
-
return o.set(e, t), O(e, t, s, o), t;
|
|
140
|
-
}
|
|
141
|
-
if (e[R]) {
|
|
142
|
-
const t = e.constructor;
|
|
143
|
-
if (t.ivueGlobalStore)
|
|
144
|
-
return o.set(e, e), e;
|
|
145
|
-
let a;
|
|
146
|
-
if (s != null && s.has(t)) {
|
|
147
|
-
P.set(t, s);
|
|
148
|
-
try {
|
|
149
|
-
a = e.clone(...s.get(t) ?? []);
|
|
150
|
-
} finally {
|
|
151
|
-
P.delete(t);
|
|
152
|
-
}
|
|
153
|
-
} else
|
|
154
|
-
a = e.clone();
|
|
155
|
-
return o.set(e, a), a;
|
|
156
|
-
}
|
|
157
|
-
if (e instanceof Date)
|
|
158
|
-
return new Date(e.getTime());
|
|
159
|
-
if (e instanceof Map) {
|
|
160
|
-
const t = new e.constructor();
|
|
161
|
-
o.set(e, t);
|
|
162
|
-
for (const [a, r] of e)
|
|
163
|
-
t.set(d(a, s, o), d(r, s, o));
|
|
164
|
-
return t;
|
|
165
|
-
}
|
|
166
|
-
if (e instanceof Set) {
|
|
167
|
-
const t = new e.constructor();
|
|
168
|
-
o.set(e, t);
|
|
169
|
-
for (const a of e)
|
|
170
|
-
t.add(d(a, s, o));
|
|
171
|
-
return t;
|
|
172
|
-
}
|
|
173
|
-
if (e instanceof RegExp) {
|
|
174
|
-
const t = new RegExp(e.source, e.flags);
|
|
175
|
-
return t.lastIndex = e.lastIndex, t;
|
|
176
|
-
}
|
|
177
|
-
if (e instanceof Error) {
|
|
178
|
-
const t = new e.constructor(e.message);
|
|
179
|
-
return o.set(e, t), O(e, t, s, o), t;
|
|
180
|
-
}
|
|
181
|
-
if (e instanceof Promise || e instanceof WeakMap || e instanceof WeakSet)
|
|
182
|
-
return o.set(e, e), e;
|
|
183
|
-
if (e instanceof DataView) {
|
|
184
|
-
const t = new DataView(e.buffer.slice(0), e.byteOffset, e.byteLength);
|
|
185
|
-
return o.set(e, t), t;
|
|
186
|
-
}
|
|
187
|
-
if (ArrayBuffer.isView(e) && !(e instanceof DataView)) {
|
|
188
|
-
const t = new e.constructor(e);
|
|
189
|
-
return o.set(e, t), t;
|
|
190
|
-
}
|
|
191
|
-
if (e instanceof ArrayBuffer) {
|
|
192
|
-
const t = e.slice(0);
|
|
193
|
-
return o.set(e, t), t;
|
|
194
|
-
}
|
|
195
|
-
const c = M(n);
|
|
196
|
-
return o.set(e, c), O(e, c, s, o), c;
|
|
197
|
-
}, Z = () => {
|
|
198
|
-
h = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap();
|
|
199
|
-
}, $ = { copyOwnProps: O, getClassAccessorsMethodsMap: A, getClassPropertiesAccessorsMap: k };
|
|
200
93
|
export {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
P as activeDeepCloneArgsMap,
|
|
205
|
-
Z as clearCache,
|
|
206
|
-
O as copyOwnProps,
|
|
207
|
-
d as deepClone,
|
|
208
|
-
H as iref,
|
|
209
|
-
K as isClass,
|
|
210
|
-
J as ishallowRef,
|
|
211
|
-
Q as iuse,
|
|
212
|
-
F as ivue,
|
|
213
|
-
v as propertiesAccessorsMaps,
|
|
214
|
-
X as propsWithDefaults
|
|
94
|
+
C as Reactive,
|
|
95
|
+
P as isClass,
|
|
96
|
+
D as propsWithDefaults
|
|
215
97
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(l,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],f):f((l=typeof globalThis<"u"?globalThis:l||self).ivue={},l.Vue)})(this,function(l,f){"use strict";const g=Object.hasOwn,d=Object.getPrototypeOf,v=Object.getOwnPropertyDescriptor,O=Object.getOwnPropertyNames,a=Object.defineProperty,m=Object.prototype,y=Symbol.for("ivue.raw"),b=Symbol.for("ivue.scope"),h=Symbol.for("ivue.processed");function s(e){const r=f.toRaw(e);if(r!==e)return r[y]??(r[y]=r);const n=e[y];return n?n===e?n:f.toRaw(n):e[y]=e}function j(e,r,n,o){a(e,r,{configurable:!0,enumerable:!1,get(){const t=s(this);return t[n]??(t[n]=o.bind(t))},set(t){s(this)[n]=t}})}function S(e,r,n,o,t){const u=r[0]==="$";a(e,r,{configurable:!0,enumerable:!1,get:function(){const c=s(this);if(n in c)return c[n];const i=o.call(c);return u?(c[n]=i,i):(f.isRef(i)?c[n]=i:a(e,r,{configurable:!0,enumerable:!1,get(){return o.call(s(this))},set:t?function(p){return t.call(s(this),p)}:void 0}),i)},set:t?function(c){return t.call(s(this),c)}:void 0})}const w=e=>{var r;return typeof e=="function"&&!!e.prototype&&!((r=v(e,"prototype"))!=null&&r.writable)};l.Reactive=function(e){const r=[];let n=e.prototype;for(;n&&n!==m;)r.push(n),n=d(n);r.reverse();for(const o of r){if(g(o,h))continue;const t=O(o),u=[];for(const c of t){if(c==="constructor")continue;const i=v(o,c);if(typeof i.value=="function"){const p=Symbol(c);u.push(p),j(o,c,p,i.value)}else if(i.get){const p=Symbol(c);u.push(p),S(o,c,p,i.get,i.set)}}a(o,h,{value:u})}return g(e.prototype,"$stopEffects")||(a(e.prototype,"$watch",{enumerable:!1,configurable:!0,writable:!0,value:function(...o){const t=s(this);return(t[b]??(t[b]=f.effectScope(!0))).run(()=>f.watch(...o))}}),a(e.prototype,"$watchEffect",{enumerable:!1,configurable:!0,writable:!0,value:function(...o){const t=s(this);return(t[b]??(t[b]=f.effectScope(!0))).run(()=>f.watchEffect(...o))}}),a(e.prototype,"$stopEffects",{enumerable:!1,configurable:!0,writable:!0,value:function(){const o=s(this);try{const t=o[b];t&&t.stop()}finally{delete o[b];let t=d(o);for(;t&&t!==m;){const u=t[h];if(u)for(const c of u)delete o[c];t=d(t)}}}})),e},l.isClass=w,l.propsWithDefaults=(e,r,n)=>{const o={};for(const t in r){const u=e==null?void 0:e[t],c=r[t];o[t]={...c},c.required||u===void 0||(typeof u=="object"&&u!==null?o[t].default=()=>n?n(u):structuredClone(u):w(u)?o[t].default=()=>u:o[t].default=u)}return o},Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|