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/dist/index.es.js CHANGED
@@ -1,88 +1,97 @@
1
- import { reactive as v, computed as b, ref as A, shallowRef as D, toRef as m } from "vue";
2
- const d = /* @__PURE__ */ new Map();
3
- function E(e) {
4
- if (d.has(e))
5
- return d.get(e);
6
- const o = /* @__PURE__ */ new Map();
7
- let t = e.prototype;
8
- for (; t.constructor !== Object; )
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 M(e, ...o) {
16
- var i, O;
17
- const t = E(e), f = t != null && t.size ? {} : null, r = v(new e(...o));
18
- for (const [n, l] of t)
19
- ((i = e == null ? void 0 : e.ivue) == null ? void 0 : i[n]) !== !1 && Object.defineProperty(r, n, { get: l.get ? () => {
20
- var a, g;
21
- return n in f ? f[n] : f[n] = b({ get: (a = l.get) == null ? void 0 : a.bind(r), set: (g = l.set) == null ? void 0 : g.bind(r) });
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
- const z = A, N = D;
66
- function W(e, ...o) {
67
- return typeof e == "function" ? R(e) ? M(e, ...o).toRefs(!0) : e(...o) : e;
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 R(e) {
70
- var o;
71
- return typeof e == "function" && !!e.prototype && !((o = Object.getOwnPropertyDescriptor(e, "prototype")) != null && o.writable);
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
- function k(e, o) {
74
- for (const t in o)
75
- typeof (e == null ? void 0 : e[t]) == "object" && (e == null ? void 0 : e[t]) !== null || R(e == null ? void 0 : e[t]) ? o[t].default = () => e == null ? void 0 : e[t] : o[t].default = e == null ? void 0 : e[t];
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
- d as descriptorsMap,
80
- E as getAllClassDescriptors,
81
- C as getAllClassProperties,
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(c,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],f):f((c=typeof globalThis<"u"?globalThis:c||self).ivue={},c.Vue)})(this,function(c,f){"use strict";const y=new Map;function j(t){if(y.has(t))return y.get(t);const r=new Map;let e=t.prototype;for(;e.constructor!==Object;)Object.entries(Object.getOwnPropertyDescriptors(e)).forEach(([l,n])=>{const i=r.get(l);i!==n&&(n!=null&&n.get||n!=null&&n.set)&&(i!=null&&i.get&&(n.get=i==null?void 0:i.get),i!=null&&i.set&&(n.set=i==null?void 0:i.set),r.set(l,n))}),e=Object.getPrototypeOf(e);return y.set(t,r),r}function w(t,...r){var i,P;const e=j(t),l=e!=null&&e.size?{}:null,n=f.reactive(new t(...r));for(const[s,d]of e)((i=t==null?void 0:t.ivue)==null?void 0:i[s])!==!1&&Object.defineProperty(n,s,{get:d.get?()=>{var p,b;return s in l?l[s]:l[s]=f.computed({get:(p=d.get)==null?void 0:p.bind(n),set:(b=d.set)==null?void 0:b.bind(n)})}:void 0,set:(P=d.set)==null?void 0:P.bind(n),enumerable:!1});return Object.defineProperty(n,"toRefs",{get:()=>function(s,d,p){return function(b,S){var v,R;const g={};if(Array.isArray(b))for(let a=0;a<b.length;a++){const o=b[a];if(d.has(o))if(o in p)g[o]=p[o];else{const u=d.get(o);g[o]=p[o]=f.computed({get:(v=u==null?void 0:u.get)==null?void 0:v.bind(s),set:(R=u==null?void 0:u.set)==null?void 0:R.bind(s)})}else typeof s[o]=="function"?g[o]=s[o].bind(s):g[o]=f.toRef(s,o)}else{let a=new Set(m(s));d.forEach((o,u)=>{var M,A;g[u]=u in p?p[u]:p[u]=f.computed({get:(M=o.get)==null?void 0:M.bind(s),set:(A=o.set)==null?void 0:A.bind(s)}),a==null||a.delete(u)}),a.forEach(o=>{typeof s[o]=="function"?g[o]=s[o].bind(s):g[o]=f.toRef(s,o)}),a=null}return g}}(n,e,l),enumerable:!1}),"init"in n&&n.init(),n}const O=new Map;function m(t){if(O.has(t.constructor))return O.get(t.constructor);const r=t.constructor,e=new Set;do Object.getOwnPropertyNames(t).forEach(l=>{["caller","callee","arguments","constructor"].includes(l)||e.add(l)}),t=Object.getPrototypeOf(t);while(t.constructor!==Object);return O.set(r,e),e}const D=f.ref,E=f.shallowRef;function h(t){var r;return typeof t=="function"&&!!t.prototype&&!((r=Object.getOwnPropertyDescriptor(t,"prototype"))!=null&&r.writable)}c.descriptorsMap=y,c.getAllClassDescriptors=j,c.getAllClassProperties=m,c.iref=D,c.isClass=h,c.ishallowRef=E,c.iuse=function(t,...r){return typeof t=="function"?h(t)?w(t,...r).toRefs(!0):t(...r):t},c.ivue=w,c.propsWithDefaults=function(t,r){for(const e in r)typeof(t==null?void 0:t[e])=="object"&&(t==null?void 0:t[e])!==null||h(t==null?void 0:t[e])?r[e].default=()=>t==null?void 0:t[e]:r[e].default=t==null?void 0:t[e];return r},Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
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"})});