vref 0.1.5 → 0.1.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # VRef
2
2
 
3
- A minimal reactive library to track and respond to changes in variables, providing predictable, low-level reactivity.
3
+ A Tiny Reactive library to track and respond to changes in variables, providing predictable low-level reactivity.
4
4
 
5
5
  ---
6
6
 
@@ -30,4 +30,4 @@ user.value.name = 'Doe'; // triggers onchange
30
30
 
31
31
  ---
32
32
 
33
- Simple. Reactive. Proxy-powered.
33
+ Low-Level. Simple. Reactive.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={Get:"get",Set:"set",Add:"add",Has:"has",Delete:"delete",Clear:"clear",ForbiddenKeys:new Set(["__proto__","constructor","prototype"]),ReduceKeys:new Set(["reduce","reduceRight"])},t=Symbol("is_proxy"),r=Symbol("raw_object"),n=Symbol("parents"),i=new Set(["copyWithin","fill","push","reverse","unshift"]),a=new Set(["concat","flat","slice","toReversed","toSpliced","with"]),o=new Set(["every","findIndex","findLastIndex","flatMap","forEach","map","reduce","reduceRight","some"]),s=new Set(["entries","keys","values",Symbol.iterator]),c=new Set(["includes","indexOf","lastIndexOf"]),u=new Set(["at"]),l=new Set(["filter","find","findLast","pop","shift","sort","splice","toSorted"]),f=new Set(["copyWithin","fill","reverse","set","sort"]),d=new Set(["forEach"]),p=new Set(["forEach"]);function h(t){return e.ForbiddenKeys.has(t)}function y(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function v(e){return function(e){return"object"==typeof e&&null!==e}(e)||function(e){return Array.isArray(e)||y(e)}(e)}function g(e){return e[t]??!1}function H(e){return v(e)&&g(e)}function S(e){return e instanceof Map||e instanceof WeakMap}function w(e){return e instanceof Set||e instanceof WeakSet}function b(e){return e[r]}function k(e){return H(e)?b(e):e}function A(...e){const[t]=e;return v(t)?z(...e):t}function O(e){return e.map(e=>k(e))}function m(e,t,r,n,i){return e.map(e=>A(e,t,r,n,i,!1))}function j(e,t,r,n,i,...a){const[o,...s]=a;if("function"==typeof o){function c(...a){const s=a.map(a=>A(a,e===a?void 0:t,r,n,i,!1));return o.apply(this,s)}return[c,...s]}return a}function x(e,t,r,...n){const i=t.has(this)?O(n):n;return e[r].apply(this,i)}function R(e,t,r,n,...i){const a=t.get(this),o=a?O(i):i,s=e[r].apply(this,o);return a&&n({target:a,action:r,key:void 0,value:i,prevValue:void 0}),s===this&&a?a:s}function V(e,t,r,...n){const i=t.get(this),[a]=n,o=i?k(a):a;return e.has.call(this,o)||(e.add.call(this,o),i&&r({target:i,action:"add",key:a,value:a,prevValue:void 0})),i??this}function P(e,t,r,...n){const i=t.get(this),[a]=n,o=i?k(a):a,s=function(e,t){return e instanceof WeakMap?e.get(t):e.has(t)?t:void 0}(this,o),c=e.delete.call(this,o);return c&&i&&r({target:i,action:"delete",key:a,value:void 0,prevValue:s}),c}function M(e,t,r,n,...i){const a=t.get(this),[o]=i,s=a?k(o):o,c=e.get.call(this,s);return a?A(c,a,t,r,n):c}function _(e,t,...r){const n=t.has(this),[i]=r,a=n?k(i):i;return e.has.call(this,a)}function W(e,t,r,...n){const i=t.get(this),[a,o]=n,s=i?k(a):a,c=i?k(o):o,u=e.get.call(this,s);return Object.is(c,u)||(e.set.call(this,s,c),i&&r({target:i,action:"set",key:a,value:o,prevValue:u})),i??this}function E(e,t,r){if(this.size>0){const n=t.get(this);e.clear.call(this),n&&r({target:n,action:"clear",key:void 0,value:void 0,prevValue:void 0})}}function K(e,t,r,...n){const i=g(this)||t.has(this)?O(n):n;return e[r].apply(this,i)}function L(t,r,n,i,a,...o){const s=r.get(this);let c;return c=s?e.ReduceKeys.has(i)?function(e,t,r,n,i,...a){const[o,...s]=a;return[function(...a){const s=a.map((a,o)=>o>0?A(a,e===a?void 0:t,r,n,i,!1):a);return o.apply(this,s)},...s]}(this,s,r,n,a,...o):j(this,s,r,n,a,...o):o,t[i].apply(this,c)}function D(e,t,r,n,i){const a=t.get(this),o=e[n].call(this);return a?function(e,t,r,n,i,a,o){const s=Array.isArray(t),c="entries"===a||S(t)&&a===Symbol.iterator,u=Object.create(Object.getPrototypeOf(e));return u.next=function(t){const a=k(this===u?e:this),l=e.next.call(a,t);if(!l.done)if(c)if(s){const[,e]=l.value;l.value[1]=A(e,r,n,i,o,!1)}else l.value=l.value.map(e=>A(e,r,n,i,o,!1));else l.value=A(l.value,r,n,i,o,!1);return l},u[Symbol.iterator]=function(){return k(this)},u}(o,this,a,t,r,n,i):o}function I(e,t,r,n,i,...a){const o=t.get(this),s=o?O(a):a,c=e[n].apply(this,s);return o?m(c,o,t,r,i):c}function C(e,t,r,n,i,...a){const o=t.get(this),s=o?O(a):a,c=e[n].apply(this,s);return o?A(c,o,t,r,i):c}function F(e,t,r,n,i,...a){const o=t.get(this);let s;switch(n){case"filter":case"find":case"findLast":case"sort":case"toSorted":const c=o?j(this,o,t,r,i,...a):a;switch(s=e[n].apply(this,c),n){case"filter":case"toSorted":return o?m(s,o,t,r,i):s;case"find":case"findLast":return o?A(s,o,t,r,i):s;case"sort":return o&&i({target:o,action:"sort",key:void 0,value:a,prevValue:void 0}),o??this}case"pop":case"shift":case"splice":const u=o?O(a):a;switch(s=e[n].apply(this,u),o&&i({target:o,action:n,key:void 0,value:a,prevValue:void 0}),n){case"pop":case"shift":return o?A(s,o,t,r,i,!1):s;case"splice":return o?m(s,o,t,r,i):s}}}function G(e,...t){return function(...r){const[n,i]=t;let a;var o;return o=n,a="[object Object]"!==Object.prototype.toString.call(o)||Object.getPrototypeOf(o)!==Object.prototype&&!o.constructor?k(this):this,function(e,t){H(e)&&t.set(b(e),e)}(this,i),e.apply(a,t.concat(r))}}function z(H,b,k,A,O,m){if(g(H))return H;let j=A.get(H);b&&(j?j.add(b):(j=new Set([b]),A.set(H,j)));const B=k.get(H);if(B)return B;let q=!1;const J=new Proxy(H,{get(g,b,m){if(b===n)return j;if(b===t)return!0;if(b===r)return H;let B;try{B=Reflect.get(g,b,m)}catch{B=Reflect.get(g,b)}if(!h(b)&&void 0!==B){if(v(B))return z(B,J,k,A,O);if("function"==typeof B){const t=function(e,t,r,n,i){return{conflictArrayHandler:G(F,e,r,n,t,i),mutationArrayHandler:G(R,e,r,t,i),producerArrayHandler:G(I,e,r,n,t,i),iterationHandler:G(L,e,r,n,t,i),iteratorHandler:G(D,e,r,n,t,i),lookupArrayHandler:G(x,e,r,t),pickingArrayHandler:G(C,e,r,n,t,i),getHandler:G(M,e,r,n,i),setHandler:G(W,e,r,i),addHandler:G(V,e,r,i),hasHandler:G(_,e,r),deleteHandler:G(P,e,r,i),clearHandler:G(E,e,r,i),defaultHandler:G(K,e,r,t)}}(g,b,k,A,O);if(Array.isArray(g)){if(l.has(b))return t.conflictArrayHandler;if(i.has(b))return t.mutationArrayHandler;if(a.has(b))return t.producerArrayHandler;if(o.has(b))return t.iterationHandler;if(s.has(b))return t.iteratorHandler;if(c.has(b))return t.lookupArrayHandler;if(u.has(b))return t.pickingArrayHandler}if(y(g)&&f.has(b))return t.mutationArrayHandler;if(S(g)){if(b===e.Get)return t.getHandler;if(b===e.Set)return t.setHandler}if(w(g)&&b===e.Add)return t.addHandler;if(g instanceof Map&&d.has(b)||g instanceof Set&&p.has(b))return t.iterationHandler;if(function(e){return e instanceof Map||e instanceof Set}(g)){if(b===e.Clear)return t.clearHandler;if(s.has(b))return t.iteratorHandler}if(function(e){return S(e)||w(e)}(g)){if(b===e.Has)return t.hasHandler;if(b===e.Delete)return t.deleteHandler}return t.defaultHandler}}return B},set(e,t,r,n){if(h(t))return!0;const i=e[t];if(!Object.is(i,r)){q=!0;const a=Reflect.set(e,t,r,n);return q=!1,a&&O({target:J,action:"set",key:t,value:r,prevValue:i}),a}return!0},deleteProperty(e,t){if(h(t))return!0;if(Object.prototype.hasOwnProperty.call(e,t)){const r=e[t],n=Reflect.deleteProperty(e,t);return n&&O({target:J,action:"delete",key:t,value:void 0,prevValue:r}),n}return!0},defineProperty(e,t,r){if(h(t))return!0;const n=e[t],i=Reflect.defineProperty(e,t,r);if(!q&&i){const e=r.value;Object.is(n,e)||O({target:J,action:"define",key:t,value:e,prevValue:n})}return i},setPrototypeOf:()=>!0});return(m??1)&&k.set(H,J),J}exports.default=function(e,t,r){const n=r?.cache??new WeakMap,i=r?.cacheParents??new WeakMap;return z(Object.preventExtensions({value:e}),void 0,n,i,t)},exports.getRaw=k,exports.isRef=H;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={Get:"get",Set:"set",Add:"add",Has:"has",Delete:"delete",Clear:"clear",ReduceKeys:new Set(["reduce","reduceRight"]),ForbiddenKeys:new Set(["__proto__","constructor","prototype"])},t=Symbol("is_proxy"),r=Symbol("raw_object"),n=Symbol("parents"),i=new Set(["copyWithin","fill","push","reverse","unshift"]),a=new Set(["concat","flat","slice","toReversed","toSpliced","with"]),o=new Set(["every","findIndex","findLastIndex","flatMap","forEach","map","reduce","reduceRight","some"]),s=new Set(["entries","keys","values",Symbol.iterator]),c=new Set(["includes","indexOf","lastIndexOf"]),u=new Set(["at"]),l=new Set(["filter","find","findLast","pop","shift","sort","splice","toSorted"]),f=new Set(["copyWithin","fill","reverse","set","sort"]),d=new Set(["forEach"]),p=new Set(["forEach"]);function h(t){return e.ForbiddenKeys.has(t)}function y(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function v(e){return function(e){return"object"==typeof e&&null!==e}(e)||function(e){return Array.isArray(e)||y(e)}(e)}function g(e){return e[t]??!1}function H(e){return v(e)&&g(e)}function S(e){return e instanceof Map||e instanceof WeakMap}function w(e){return e instanceof Set||e instanceof WeakSet}function b(e){return e[r]}function k(e){return H(e)?b(e):e}function A(...e){const[t]=e;return v(t)?z(...e):t}function O(e){return e.map(e=>k(e))}function m(e,t,r,n,i){return e.map(e=>A(e,t,r,n,i,!1))}function j(e,t,r,n,i,...a){const[o,...s]=a;if("function"==typeof o){function c(...a){const s=a.map(a=>A(a,e===a?void 0:t,r,n,i,!1));return o.apply(this,s)}return[c,...s]}return a}function x(e,t,r,...n){const i=t.has(this)?O(n):n;return e[r].apply(this,i)}function R(e,t,r,n,...i){const a=t.get(this),o=a?O(i):i,s=e[r].apply(this,o);return a&&n({target:a,action:r,key:void 0,value:i,prevValue:void 0}),s===this&&a?a:s}function V(e,t,r,...n){const i=t.get(this),[a]=n,o=i?k(a):a;return e.has.call(this,o)||(e.add.call(this,o),i&&r({target:i,action:"add",key:a,value:a,prevValue:void 0})),i??this}function P(e,t,r,...n){const i=t.get(this),[a]=n,o=i?k(a):a,s=function(e,t){return e instanceof WeakMap?e.get(t):e.has(t)?t:void 0}(this,o),c=e.delete.call(this,o);return c&&i&&r({target:i,action:"delete",key:a,value:void 0,prevValue:s}),c}function M(e,t,r,n,...i){const a=t.get(this),[o]=i,s=a?k(o):o,c=e.get.call(this,s);return a?A(c,a,t,r,n):c}function _(e,t,...r){const n=t.has(this),[i]=r,a=n?k(i):i;return e.has.call(this,a)}function W(e,t,r,...n){const i=t.get(this),[a,o]=n,s=i?k(a):a,c=i?k(o):o,u=e.get.call(this,s);return Object.is(c,u)||(e.set.call(this,s,c),i&&r({target:i,action:"set",key:a,value:o,prevValue:u})),i??this}function E(e,t,r){if(this.size>0){const n=t.get(this);e.clear.call(this),n&&r({target:n,action:"clear",key:void 0,value:void 0,prevValue:void 0})}}function K(e,t,r,...n){const i=g(this)||t.has(this)?O(n):n;return e[r].apply(this,i)}function L(t,r,n,i,a,...o){const s=r.get(this);let c;return c=s?function(t){return e.ReduceKeys.has(t)}(i)?function(e,t,r,n,i,...a){const[o,...s]=a;return[function(...a){const s=a.map((a,o)=>o>0?A(a,e===a?void 0:t,r,n,i,!1):a);return o.apply(this,s)},...s]}(this,s,r,n,a,...o):j(this,s,r,n,a,...o):o,t[i].apply(this,c)}function D(e,t,r,n,i){const a=t.get(this),o=e[n].call(this);return a?function(e,t,r,n,i,a,o){const s=Array.isArray(t),c="entries"===a||S(t)&&a===Symbol.iterator,u=Object.create(Object.getPrototypeOf(e));return u.next=function(t){const a=k(this===u?e:this),l=e.next.call(a,t);if(!l.done)if(c)if(s){const[,e]=l.value;l.value[1]=A(e,r,n,i,o,!1)}else l.value=l.value.map(e=>A(e,r,n,i,o,!1));else l.value=A(l.value,r,n,i,o,!1);return l},u[Symbol.iterator]=function(){return k(this)},u}(o,this,a,t,r,n,i):o}function I(e,t,r,n,i,...a){const o=t.get(this),s=o?O(a):a,c=e[n].apply(this,s);return o?m(c,o,t,r,i):c}function C(e,t,r,n,i,...a){const o=t.get(this),s=o?O(a):a,c=e[n].apply(this,s);return o?A(c,o,t,r,i):c}function F(e,t,r,n,i,...a){const o=t.get(this);let s;switch(n){case"filter":case"find":case"findLast":case"sort":case"toSorted":const c=o?j(this,o,t,r,i,...a):a;switch(s=e[n].apply(this,c),n){case"filter":case"toSorted":return o?m(s,o,t,r,i):s;case"find":case"findLast":return o?A(s,o,t,r,i):s;case"sort":return o&&i({target:o,action:"sort",key:void 0,value:a,prevValue:void 0}),o??this}case"pop":case"shift":case"splice":const u=o?O(a):a;switch(s=e[n].apply(this,u),o&&i({target:o,action:n,key:void 0,value:a,prevValue:void 0}),n){case"pop":case"shift":return o?A(s,o,t,r,i,!1):s;case"splice":return o?m(s,o,t,r,i):s}}}function G(e,...t){return function(...r){const[n,i]=t;let a;var o;return o=n,a="[object Object]"!==Object.prototype.toString.call(o)||Object.getPrototypeOf(o)!==Object.prototype&&!o.constructor?k(this):this,function(e,t){H(e)&&t.set(b(e),e)}(this,i),e.apply(a,t.concat(r))}}function z(H,b,k,A,O,m){if(g(H))return H;let j=A.get(H);b&&(j?j.add(b):(j=new Set([b]),A.set(H,j)));const B=k.get(H);if(B)return B;let q=!1;const J=new Proxy(H,{get(g,b,m){if(b===n)return j;if(b===t)return!0;if(b===r)return H;let B;try{B=Reflect.get(g,b,m)}catch{B=Reflect.get(g,b)}if(!h(b)&&void 0!==B){if(v(B))return z(B,J,k,A,O);if("function"==typeof B){const t=function(e,t,r,n,i){return{conflictArrayHandler:G(F,e,r,n,t,i),mutationArrayHandler:G(R,e,r,t,i),producerArrayHandler:G(I,e,r,n,t,i),iterationHandler:G(L,e,r,n,t,i),iteratorHandler:G(D,e,r,n,t,i),lookupArrayHandler:G(x,e,r,t),pickingArrayHandler:G(C,e,r,n,t,i),getHandler:G(M,e,r,n,i),setHandler:G(W,e,r,i),addHandler:G(V,e,r,i),hasHandler:G(_,e,r),deleteHandler:G(P,e,r,i),clearHandler:G(E,e,r,i),defaultHandler:G(K,e,r,t)}}(g,b,k,A,O);if(Array.isArray(g)){if(l.has(b))return t.conflictArrayHandler;if(i.has(b))return t.mutationArrayHandler;if(a.has(b))return t.producerArrayHandler;if(o.has(b))return t.iterationHandler;if(s.has(b))return t.iteratorHandler;if(c.has(b))return t.lookupArrayHandler;if(u.has(b))return t.pickingArrayHandler}if(y(g)&&f.has(b))return t.mutationArrayHandler;if(S(g)){if(b===e.Get)return t.getHandler;if(b===e.Set)return t.setHandler}if(w(g)&&b===e.Add)return t.addHandler;if(g instanceof Map&&d.has(b)||g instanceof Set&&p.has(b))return t.iterationHandler;if(function(e){return e instanceof Map||e instanceof Set}(g)){if(b===e.Clear)return t.clearHandler;if(s.has(b))return t.iteratorHandler}if(function(e){return S(e)||w(e)}(g)){if(b===e.Has)return t.hasHandler;if(b===e.Delete)return t.deleteHandler}return t.defaultHandler}}return B},set(e,t,r,n){if(h(t))return!0;const i=e[t];if(!Object.is(i,r)){q=!0;const a=Reflect.set(e,t,r,n);return q=!1,a&&O({target:J,action:"set",key:t,value:r,prevValue:i}),a}return!0},deleteProperty(e,t){if(h(t))return!0;if(Object.prototype.hasOwnProperty.call(e,t)){const r=e[t],n=Reflect.deleteProperty(e,t);return n&&O({target:J,action:"delete",key:t,value:void 0,prevValue:r}),n}return!0},defineProperty(e,t,r){if(h(t))return!0;const n=e[t],i=Reflect.defineProperty(e,t,r);if(!q&&i){const e=r.value;Object.is(n,e)||O({target:J,action:"define",key:t,value:e,prevValue:n})}return i},setPrototypeOf:()=>!0});return(m??1)&&k.set(H,J),J}exports.default=function(e,t,r){const n=r?.cache??new WeakMap,i=r?.cacheParents??new WeakMap;return z(Object.preventExtensions({value:e}),void 0,n,i,t)},exports.getRaw=k,exports.isRef=H;
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- const t={Get:"get",Set:"set",Add:"add",Has:"has",Delete:"delete",Clear:"clear",ForbiddenKeys:new Set(["__proto__","constructor","prototype"]),ReduceKeys:new Set(["reduce","reduceRight"])},e=Symbol("is_proxy"),r=Symbol("raw_object"),n=Symbol("parents"),i=new Set(["copyWithin","fill","push","reverse","unshift"]),a=new Set(["concat","flat","slice","toReversed","toSpliced","with"]),o=new Set(["every","findIndex","findLastIndex","flatMap","forEach","map","reduce","reduceRight","some"]),s=new Set(["entries","keys","values",Symbol.iterator]),c=new Set(["includes","indexOf","lastIndexOf"]),u=new Set(["at"]),l=new Set(["filter","find","findLast","pop","shift","sort","splice","toSorted"]),f=new Set(["copyWithin","fill","reverse","set","sort"]),d=new Set(["forEach"]),h=new Set(["forEach"]);function p(e){return t.ForbiddenKeys.has(e)}function y(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function v(t){return function(t){return"object"==typeof t&&null!==t}(t)||function(t){return Array.isArray(t)||y(t)}(t)}function g(t){return t[e]??!1}function H(t){return v(t)&&g(t)}function S(t){return t instanceof Map||t instanceof WeakMap}function w(t){return t instanceof Set||t instanceof WeakSet}function b(t){return t[r]}function k(t){return H(t)?b(t):t}function A(...t){const[e]=t;return v(e)?z(...t):e}function O(t){return t.map(t=>k(t))}function m(t,e,r,n,i){return t.map(t=>A(t,e,r,n,i,!1))}function j(t,e,r,n,i,...a){const[o,...s]=a;if("function"==typeof o){function c(...a){const s=a.map(a=>A(a,t===a?void 0:e,r,n,i,!1));return o.apply(this,s)}return[c,...s]}return a}function R(t,e,r,...n){const i=e.has(this)?O(n):n;return t[r].apply(this,i)}function V(t,e,r,n,...i){const a=e.get(this),o=a?O(i):i,s=t[r].apply(this,o);return a&&n({target:a,action:r,key:void 0,value:i,prevValue:void 0}),s===this&&a?a:s}function x(t,e,r,...n){const i=e.get(this),[a]=n,o=i?k(a):a;return t.has.call(this,o)||(t.add.call(this,o),i&&r({target:i,action:"add",key:a,value:a,prevValue:void 0})),i??this}function P(t,e,r,...n){const i=e.get(this),[a]=n,o=i?k(a):a,s=function(t,e){return t instanceof WeakMap?t.get(e):t.has(e)?e:void 0}(this,o),c=t.delete.call(this,o);return c&&i&&r({target:i,action:"delete",key:a,value:void 0,prevValue:s}),c}function M(t,e,r,n,...i){const a=e.get(this),[o]=i,s=a?k(o):o,c=t.get.call(this,s);return a?A(c,a,e,r,n):c}function W(t,e,...r){const n=e.has(this),[i]=r,a=n?k(i):i;return t.has.call(this,a)}function _(t,e,r,...n){const i=e.get(this),[a,o]=n,s=i?k(a):a,c=i?k(o):o,u=t.get.call(this,s);return Object.is(c,u)||(t.set.call(this,s,c),i&&r({target:i,action:"set",key:a,value:o,prevValue:u})),i??this}function E(t,e,r){if(this.size>0){const n=e.get(this);t.clear.call(this),n&&r({target:n,action:"clear",key:void 0,value:void 0,prevValue:void 0})}}function K(t,e,r,...n){const i=g(this)||e.has(this)?O(n):n;return t[r].apply(this,i)}function L(e,r,n,i,a,...o){const s=r.get(this);let c;return c=s?t.ReduceKeys.has(i)?function(t,e,r,n,i,...a){const[o,...s]=a;return[function(...a){const s=a.map((a,o)=>o>0?A(a,t===a?void 0:e,r,n,i,!1):a);return o.apply(this,s)},...s]}(this,s,r,n,a,...o):j(this,s,r,n,a,...o):o,e[i].apply(this,c)}function D(t,e,r,n,i){const a=e.get(this),o=t[n].call(this);return a?function(t,e,r,n,i,a,o){const s=Array.isArray(e),c="entries"===a||S(e)&&a===Symbol.iterator,u=Object.create(Object.getPrototypeOf(t));return u.next=function(e){const a=k(this===u?t:this),l=t.next.call(a,e);if(!l.done)if(c)if(s){const[,t]=l.value;l.value[1]=A(t,r,n,i,o,!1)}else l.value=l.value.map(t=>A(t,r,n,i,o,!1));else l.value=A(l.value,r,n,i,o,!1);return l},u[Symbol.iterator]=function(){return k(this)},u}(o,this,a,e,r,n,i):o}function I(t,e,r,n,i,...a){const o=e.get(this),s=o?O(a):a,c=t[n].apply(this,s);return o?m(c,o,e,r,i):c}function C(t,e,r,n,i,...a){const o=e.get(this),s=o?O(a):a,c=t[n].apply(this,s);return o?A(c,o,e,r,i):c}function F(t,e,r,n,i,...a){const o=e.get(this);let s;switch(n){case"filter":case"find":case"findLast":case"sort":case"toSorted":const c=o?j(this,o,e,r,i,...a):a;switch(s=t[n].apply(this,c),n){case"filter":case"toSorted":return o?m(s,o,e,r,i):s;case"find":case"findLast":return o?A(s,o,e,r,i):s;case"sort":return o&&i({target:o,action:"sort",key:void 0,value:a,prevValue:void 0}),o??this}case"pop":case"shift":case"splice":const u=o?O(a):a;switch(s=t[n].apply(this,u),o&&i({target:o,action:n,key:void 0,value:a,prevValue:void 0}),n){case"pop":case"shift":return o?A(s,o,e,r,i,!1):s;case"splice":return o?m(s,o,e,r,i):s}}}function G(t,...e){return function(...r){const[n,i]=e;let a;var o;return o=n,a="[object Object]"!==Object.prototype.toString.call(o)||Object.getPrototypeOf(o)!==Object.prototype&&!o.constructor?k(this):this,function(t,e){H(t)&&e.set(b(t),t)}(this,i),t.apply(a,e.concat(r))}}function z(H,b,k,A,O,m){if(g(H))return H;let j=A.get(H);b&&(j?j.add(b):(j=new Set([b]),A.set(H,j)));const B=k.get(H);if(B)return B;let q=!1;const J=new Proxy(H,{get(g,b,m){if(b===n)return j;if(b===e)return!0;if(b===r)return H;let B;try{B=Reflect.get(g,b,m)}catch{B=Reflect.get(g,b)}if(!p(b)&&void 0!==B){if(v(B))return z(B,J,k,A,O);if("function"==typeof B){const e=function(t,e,r,n,i){return{conflictArrayHandler:G(F,t,r,n,e,i),mutationArrayHandler:G(V,t,r,e,i),producerArrayHandler:G(I,t,r,n,e,i),iterationHandler:G(L,t,r,n,e,i),iteratorHandler:G(D,t,r,n,e,i),lookupArrayHandler:G(R,t,r,e),pickingArrayHandler:G(C,t,r,n,e,i),getHandler:G(M,t,r,n,i),setHandler:G(_,t,r,i),addHandler:G(x,t,r,i),hasHandler:G(W,t,r),deleteHandler:G(P,t,r,i),clearHandler:G(E,t,r,i),defaultHandler:G(K,t,r,e)}}(g,b,k,A,O);if(Array.isArray(g)){if(l.has(b))return e.conflictArrayHandler;if(i.has(b))return e.mutationArrayHandler;if(a.has(b))return e.producerArrayHandler;if(o.has(b))return e.iterationHandler;if(s.has(b))return e.iteratorHandler;if(c.has(b))return e.lookupArrayHandler;if(u.has(b))return e.pickingArrayHandler}if(y(g)&&f.has(b))return e.mutationArrayHandler;if(S(g)){if(b===t.Get)return e.getHandler;if(b===t.Set)return e.setHandler}if(w(g)&&b===t.Add)return e.addHandler;if(g instanceof Map&&d.has(b)||g instanceof Set&&h.has(b))return e.iterationHandler;if(function(t){return t instanceof Map||t instanceof Set}(g)){if(b===t.Clear)return e.clearHandler;if(s.has(b))return e.iteratorHandler}if(function(t){return S(t)||w(t)}(g)){if(b===t.Has)return e.hasHandler;if(b===t.Delete)return e.deleteHandler}return e.defaultHandler}}return B},set(t,e,r,n){if(p(e))return!0;const i=t[e];if(!Object.is(i,r)){q=!0;const a=Reflect.set(t,e,r,n);return q=!1,a&&O({target:J,action:"set",key:e,value:r,prevValue:i}),a}return!0},deleteProperty(t,e){if(p(e))return!0;if(Object.prototype.hasOwnProperty.call(t,e)){const r=t[e],n=Reflect.deleteProperty(t,e);return n&&O({target:J,action:"delete",key:e,value:void 0,prevValue:r}),n}return!0},defineProperty(t,e,r){if(p(e))return!0;const n=t[e],i=Reflect.defineProperty(t,e,r);if(!q&&i){const t=r.value;Object.is(n,t)||O({target:J,action:"define",key:e,value:t,prevValue:n})}return i},setPrototypeOf:()=>!0});return(m??1)&&k.set(H,J),J}function B(t,e,r){const n=r?.cache??new WeakMap,i=r?.cacheParents??new WeakMap;return z(Object.preventExtensions({value:t}),void 0,n,i,e)}export{B as default,k as getRaw,H as isRef};
1
+ const t={Get:"get",Set:"set",Add:"add",Has:"has",Delete:"delete",Clear:"clear",ReduceKeys:new Set(["reduce","reduceRight"]),ForbiddenKeys:new Set(["__proto__","constructor","prototype"])},e=Symbol("is_proxy"),r=Symbol("raw_object"),n=Symbol("parents"),i=new Set(["copyWithin","fill","push","reverse","unshift"]),a=new Set(["concat","flat","slice","toReversed","toSpliced","with"]),o=new Set(["every","findIndex","findLastIndex","flatMap","forEach","map","reduce","reduceRight","some"]),s=new Set(["entries","keys","values",Symbol.iterator]),c=new Set(["includes","indexOf","lastIndexOf"]),u=new Set(["at"]),l=new Set(["filter","find","findLast","pop","shift","sort","splice","toSorted"]),f=new Set(["copyWithin","fill","reverse","set","sort"]),d=new Set(["forEach"]),h=new Set(["forEach"]);function p(e){return t.ForbiddenKeys.has(e)}function y(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function v(t){return function(t){return"object"==typeof t&&null!==t}(t)||function(t){return Array.isArray(t)||y(t)}(t)}function g(t){return t[e]??!1}function H(t){return v(t)&&g(t)}function S(t){return t instanceof Map||t instanceof WeakMap}function w(t){return t instanceof Set||t instanceof WeakSet}function b(t){return t[r]}function k(t){return H(t)?b(t):t}function A(...t){const[e]=t;return v(e)?z(...t):e}function O(t){return t.map(t=>k(t))}function m(t,e,r,n,i){return t.map(t=>A(t,e,r,n,i,!1))}function j(t,e,r,n,i,...a){const[o,...s]=a;if("function"==typeof o){function c(...a){const s=a.map(a=>A(a,t===a?void 0:e,r,n,i,!1));return o.apply(this,s)}return[c,...s]}return a}function R(t,e,r,...n){const i=e.has(this)?O(n):n;return t[r].apply(this,i)}function V(t,e,r,n,...i){const a=e.get(this),o=a?O(i):i,s=t[r].apply(this,o);return a&&n({target:a,action:r,key:void 0,value:i,prevValue:void 0}),s===this&&a?a:s}function x(t,e,r,...n){const i=e.get(this),[a]=n,o=i?k(a):a;return t.has.call(this,o)||(t.add.call(this,o),i&&r({target:i,action:"add",key:a,value:a,prevValue:void 0})),i??this}function P(t,e,r,...n){const i=e.get(this),[a]=n,o=i?k(a):a,s=function(t,e){return t instanceof WeakMap?t.get(e):t.has(e)?e:void 0}(this,o),c=t.delete.call(this,o);return c&&i&&r({target:i,action:"delete",key:a,value:void 0,prevValue:s}),c}function M(t,e,r,n,...i){const a=e.get(this),[o]=i,s=a?k(o):o,c=t.get.call(this,s);return a?A(c,a,e,r,n):c}function W(t,e,...r){const n=e.has(this),[i]=r,a=n?k(i):i;return t.has.call(this,a)}function _(t,e,r,...n){const i=e.get(this),[a,o]=n,s=i?k(a):a,c=i?k(o):o,u=t.get.call(this,s);return Object.is(c,u)||(t.set.call(this,s,c),i&&r({target:i,action:"set",key:a,value:o,prevValue:u})),i??this}function E(t,e,r){if(this.size>0){const n=e.get(this);t.clear.call(this),n&&r({target:n,action:"clear",key:void 0,value:void 0,prevValue:void 0})}}function K(t,e,r,...n){const i=g(this)||e.has(this)?O(n):n;return t[r].apply(this,i)}function L(e,r,n,i,a,...o){const s=r.get(this);let c;return c=s?function(e){return t.ReduceKeys.has(e)}(i)?function(t,e,r,n,i,...a){const[o,...s]=a;return[function(...a){const s=a.map((a,o)=>o>0?A(a,t===a?void 0:e,r,n,i,!1):a);return o.apply(this,s)},...s]}(this,s,r,n,a,...o):j(this,s,r,n,a,...o):o,e[i].apply(this,c)}function D(t,e,r,n,i){const a=e.get(this),o=t[n].call(this);return a?function(t,e,r,n,i,a,o){const s=Array.isArray(e),c="entries"===a||S(e)&&a===Symbol.iterator,u=Object.create(Object.getPrototypeOf(t));return u.next=function(e){const a=k(this===u?t:this),l=t.next.call(a,e);if(!l.done)if(c)if(s){const[,t]=l.value;l.value[1]=A(t,r,n,i,o,!1)}else l.value=l.value.map(t=>A(t,r,n,i,o,!1));else l.value=A(l.value,r,n,i,o,!1);return l},u[Symbol.iterator]=function(){return k(this)},u}(o,this,a,e,r,n,i):o}function I(t,e,r,n,i,...a){const o=e.get(this),s=o?O(a):a,c=t[n].apply(this,s);return o?m(c,o,e,r,i):c}function C(t,e,r,n,i,...a){const o=e.get(this),s=o?O(a):a,c=t[n].apply(this,s);return o?A(c,o,e,r,i):c}function F(t,e,r,n,i,...a){const o=e.get(this);let s;switch(n){case"filter":case"find":case"findLast":case"sort":case"toSorted":const c=o?j(this,o,e,r,i,...a):a;switch(s=t[n].apply(this,c),n){case"filter":case"toSorted":return o?m(s,o,e,r,i):s;case"find":case"findLast":return o?A(s,o,e,r,i):s;case"sort":return o&&i({target:o,action:"sort",key:void 0,value:a,prevValue:void 0}),o??this}case"pop":case"shift":case"splice":const u=o?O(a):a;switch(s=t[n].apply(this,u),o&&i({target:o,action:n,key:void 0,value:a,prevValue:void 0}),n){case"pop":case"shift":return o?A(s,o,e,r,i,!1):s;case"splice":return o?m(s,o,e,r,i):s}}}function G(t,...e){return function(...r){const[n,i]=e;let a;var o;return o=n,a="[object Object]"!==Object.prototype.toString.call(o)||Object.getPrototypeOf(o)!==Object.prototype&&!o.constructor?k(this):this,function(t,e){H(t)&&e.set(b(t),t)}(this,i),t.apply(a,e.concat(r))}}function z(H,b,k,A,O,m){if(g(H))return H;let j=A.get(H);b&&(j?j.add(b):(j=new Set([b]),A.set(H,j)));const B=k.get(H);if(B)return B;let q=!1;const J=new Proxy(H,{get(g,b,m){if(b===n)return j;if(b===e)return!0;if(b===r)return H;let B;try{B=Reflect.get(g,b,m)}catch{B=Reflect.get(g,b)}if(!p(b)&&void 0!==B){if(v(B))return z(B,J,k,A,O);if("function"==typeof B){const e=function(t,e,r,n,i){return{conflictArrayHandler:G(F,t,r,n,e,i),mutationArrayHandler:G(V,t,r,e,i),producerArrayHandler:G(I,t,r,n,e,i),iterationHandler:G(L,t,r,n,e,i),iteratorHandler:G(D,t,r,n,e,i),lookupArrayHandler:G(R,t,r,e),pickingArrayHandler:G(C,t,r,n,e,i),getHandler:G(M,t,r,n,i),setHandler:G(_,t,r,i),addHandler:G(x,t,r,i),hasHandler:G(W,t,r),deleteHandler:G(P,t,r,i),clearHandler:G(E,t,r,i),defaultHandler:G(K,t,r,e)}}(g,b,k,A,O);if(Array.isArray(g)){if(l.has(b))return e.conflictArrayHandler;if(i.has(b))return e.mutationArrayHandler;if(a.has(b))return e.producerArrayHandler;if(o.has(b))return e.iterationHandler;if(s.has(b))return e.iteratorHandler;if(c.has(b))return e.lookupArrayHandler;if(u.has(b))return e.pickingArrayHandler}if(y(g)&&f.has(b))return e.mutationArrayHandler;if(S(g)){if(b===t.Get)return e.getHandler;if(b===t.Set)return e.setHandler}if(w(g)&&b===t.Add)return e.addHandler;if(g instanceof Map&&d.has(b)||g instanceof Set&&h.has(b))return e.iterationHandler;if(function(t){return t instanceof Map||t instanceof Set}(g)){if(b===t.Clear)return e.clearHandler;if(s.has(b))return e.iteratorHandler}if(function(t){return S(t)||w(t)}(g)){if(b===t.Has)return e.hasHandler;if(b===t.Delete)return e.deleteHandler}return e.defaultHandler}}return B},set(t,e,r,n){if(p(e))return!0;const i=t[e];if(!Object.is(i,r)){q=!0;const a=Reflect.set(t,e,r,n);return q=!1,a&&O({target:J,action:"set",key:e,value:r,prevValue:i}),a}return!0},deleteProperty(t,e){if(p(e))return!0;if(Object.prototype.hasOwnProperty.call(t,e)){const r=t[e],n=Reflect.deleteProperty(t,e);return n&&O({target:J,action:"delete",key:e,value:void 0,prevValue:r}),n}return!0},defineProperty(t,e,r){if(p(e))return!0;const n=t[e],i=Reflect.defineProperty(t,e,r);if(!q&&i){const t=r.value;Object.is(n,t)||O({target:J,action:"define",key:e,value:t,prevValue:n})}return i},setPrototypeOf:()=>!0});return(m??1)&&k.set(H,J),J}function B(t,e,r){const n=r?.cache??new WeakMap,i=r?.cacheParents??new WeakMap;return z(Object.preventExtensions({value:t}),void 0,n,i,e)}export{B as default,k as getRaw,H as isRef};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vref",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "license": "MIT",
5
5
  "author": "John Soatra",
6
6
  "description": "A Javascript library for reactive state management.",
@@ -9,6 +9,7 @@
9
9
  "type": "git",
10
10
  "url": "https://github.com/JohnSoatra/vref"
11
11
  },
12
+ "homepage": "https://doc.soatra.com/vref",
12
13
  "main": "dist/index.cjs.cjs",
13
14
  "module": "dist/index.esm.js",
14
15
  "types": "dist/index.d.ts",