ivue 1.5.8 → 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 +170 -33
- package/bin/ivue.mjs +152 -0
- package/dist/Reactive.d.ts +131 -0
- package/dist/env.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +90 -81
- package/dist/index.umd.js +1 -1
- package/lib/Reactive.ts +509 -0
- 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 +1460 -150
- package/lib/env.d.ts +1 -0
- package/lib/index.ts +1 -1
- package/lib/ivue.ts +661 -241
- package/lib/kernel.ts +18 -0
- package/package.json +51 -13
- package/skills/ivue/SKILL.md +726 -0
- package/dist/ivue.d.ts +0 -234
package/dist/index.es.js
CHANGED
|
@@ -1,88 +1,97 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const d =
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([f, r]) => {
|
|
10
|
-
const i = o.get(f);
|
|
11
|
-
i !== r && (r != null && r.get || r != null && r.set) && (i != null && i.get && (r.get = i == null ? void 0 : i.get), i != null && i.set && (r.set = i == null ? void 0 : i.set), o.set(f, r));
|
|
12
|
-
}), t = Object.getPrototypeOf(t);
|
|
13
|
-
return d.set(e, o), o;
|
|
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;
|
|
14
9
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} : void 0, set: (O = l.set) == null ? void 0 : O.bind(r), enumerable: !1 });
|
|
23
|
-
return Object.defineProperty(r, "toRefs", { get: () => function(n, l, a) {
|
|
24
|
-
return function(g, S) {
|
|
25
|
-
var w, h;
|
|
26
|
-
const p = {};
|
|
27
|
-
if (Array.isArray(g))
|
|
28
|
-
for (let u = 0; u < g.length; u++) {
|
|
29
|
-
const s = g[u];
|
|
30
|
-
if (l.has(s))
|
|
31
|
-
if (s in a)
|
|
32
|
-
p[s] = a[s];
|
|
33
|
-
else {
|
|
34
|
-
const c = l.get(s);
|
|
35
|
-
p[s] = a[s] = b({ get: (w = c == null ? void 0 : c.get) == null ? void 0 : w.bind(n), set: (h = c == null ? void 0 : c.set) == null ? void 0 : h.bind(n) });
|
|
36
|
-
}
|
|
37
|
-
else
|
|
38
|
-
typeof n[s] == "function" ? p[s] = n[s].bind(n) : p[s] = m(n, s);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
let u = new Set(C(n));
|
|
42
|
-
l.forEach((s, c) => {
|
|
43
|
-
var j, P;
|
|
44
|
-
p[c] = c in a ? a[c] : a[c] = b({ get: (j = s.get) == null ? void 0 : j.bind(n), set: (P = s.set) == null ? void 0 : P.bind(n) }), u == null || u.delete(c);
|
|
45
|
-
}), u.forEach((s) => {
|
|
46
|
-
typeof n[s] == "function" ? p[s] = n[s].bind(n) : p[s] = m(n, s);
|
|
47
|
-
}), u = null;
|
|
48
|
-
}
|
|
49
|
-
return p;
|
|
50
|
-
};
|
|
51
|
-
}(r, t, f), enumerable: !1 }), "init" in r && r.init(), r;
|
|
52
|
-
}
|
|
53
|
-
const y = /* @__PURE__ */ new Map();
|
|
54
|
-
function C(e) {
|
|
55
|
-
if (y.has(e.constructor))
|
|
56
|
-
return y.get(e.constructor);
|
|
57
|
-
const o = e.constructor, t = /* @__PURE__ */ new Set();
|
|
58
|
-
do
|
|
59
|
-
Object.getOwnPropertyNames(e).forEach((f) => {
|
|
60
|
-
["caller", "callee", "arguments", "constructor"].includes(f) || t.add(f);
|
|
61
|
-
}), e = Object.getPrototypeOf(e);
|
|
62
|
-
while (e.constructor !== Object);
|
|
63
|
-
return y.set(o, t), t;
|
|
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
|
+
} });
|
|
64
17
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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 });
|
|
68
33
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
71
|
-
|
|
34
|
+
function C(e) {
|
|
35
|
+
const r = [];
|
|
36
|
+
let n = e.prototype;
|
|
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")
|
|
46
|
+
continue;
|
|
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
|
+
}
|
|
55
|
+
}
|
|
56
|
+
a(o, y, { value: s });
|
|
57
|
+
}
|
|
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);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} })), e;
|
|
72
81
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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);
|
|
90
|
+
}
|
|
76
91
|
return o;
|
|
77
|
-
}
|
|
92
|
+
};
|
|
78
93
|
export {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
z as iref,
|
|
83
|
-
R as isClass,
|
|
84
|
-
N as ishallowRef,
|
|
85
|
-
W as iuse,
|
|
86
|
-
M as ivue,
|
|
87
|
-
k as propsWithDefaults
|
|
94
|
+
C as Reactive,
|
|
95
|
+
P as isClass,
|
|
96
|
+
D as propsWithDefaults
|
|
88
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"})});
|