Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

concave

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

concave - npm Package Compare versions

Comparing version 0.0.8-alpha2 to 0.0.8-alpha3

4

dist/concave.es.js

@@ -184,6 +184,6 @@ var __defProp = Object.defineProperty;

ownKeys(target) {
return ["$key", "use", TO_LENS];
return [...Object.keys(cache), "$key", "use"];
},
getOwnPropertyDescriptor(target, key) {
if (key === "$key" || key === "use" || key === TO_LENS) {
if (key === "$key" || key === "use") {
return {

@@ -190,0 +190,0 @@ configurable: true,

@@ -1,2 +0,2 @@

var W=Object.defineProperty,q=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var A=Object.getOwnPropertySymbols;var X=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var R=(a,l,i)=>l in a?W(a,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[l]=i,h=(a,l)=>{for(var i in l||(l={}))X.call(l,i)&&R(a,i,l[i]);if(A)for(var i of A(l))Y.call(l,i)&&R(a,i,l[i]);return a},N=(a,l)=>q(a,z(l));(function(a,l){typeof exports=="object"&&typeof module!="undefined"?l(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],l):(a=typeof globalThis!="undefined"?globalThis:a||self,l(a.Concave={},a.React))})(this,function(a,l){"use strict";function i(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var f=i(l);const w=e=>Object.prototype.toString.call(e)==="[object Object]",$=e=>JSON.parse(JSON.stringify(e)),j=e=>w(e)?h({},e):Array.isArray(e)?[...e]:$(e),_=Object.freeze({get(e){return e},set(e,n){return n}}),P=()=>_,T=(e,n,r)=>({get(o){const t=e.get(o);return n(t)},set(o,t){const s=e.get(o);return e.set(o,r(s,t))}}),V=(e,n)=>T(e,r=>r[n],(r,o)=>{const t=j(r);return t[n]=o,t}),F=(e,n)=>r=>{const o=e.get(r),t=n(o);return Object.is(o,t)?r:e.set(r,n(o))},O=e=>{const n=new Set;let r=e;return{subscribe(o){return n.add(o),()=>n.delete(o)},getSnapshot(){return r},update(o){const t=o(r);Object.is(t,r)||(r=t,n.forEach(s=>s()))}}},d=Symbol(),x=Symbol();let m=!1,I=0;const K=()=>`$$ProxyLens(${I++})`,D=e=>Array.isArray(e)||w(e),J=(e,n)=>{const r=e.createUse(e.lens);return o=>{const[t,s]=r(o);return[L(t,n),s]}},L=(e,n)=>{if(!D(e))return e;if(Reflect.has(e,d))return Reflect.get(e,d);let r;const o=new Proxy(e,{get(t,s){if(s===d)return o;if(s==="toJSON")return r!=null||(r=()=>t),r;if(s==="toLens")return n[x];const c=t[s],u=n[s];return L(c,u)},ownKeys(t){return[...Reflect.ownKeys(t),"toLens","toJSON"]},getOwnPropertyDescriptor(t,s){return s===d?{enumerable:!1,value:o}:{configurable:!0,enumerable:!0,value:o[s]}},set(){throw new Error("Cannot set property on ProxyValue")},deleteProperty(){throw new Error("Cannot delete property on ProxyValue")}});return Object.defineProperty(e,d,{value:o,enumerable:!1}),o},S=e=>{const n={};let r,o,t;const s=new Proxy({},{get(c,u){if(u!=="$$typeof"){if(u==="$key")return t!=null||(t=K()),t;if(u===x)return o!=null||(o=()=>s),o;if(u==="use")return r!=null||(r=J(e,s)),r;if(n[u]===void 0){const b=N(h({},e),{lens:V(e.lens,u)}),y=S(b);n[u]=y}return n[u]}},ownKeys(c){return["$key","use",x]},getOwnPropertyDescriptor(c,u){if(u==="$key"||u==="use"||u===x)return{configurable:!0,enumerable:!0,value:s[u]};if(u in n){if(!m){m=!0;debugger;console.warn(`"%c${String(u)}" as a key on ProxyLens is only available because it has been previously accessed. If you are iterating through keys of this object via \`{ ...obj }\` or \`Object.assign({}, obj)\`, please consider an alternative approach.`,"color: red; font-weight: bold;")}return{configurable:!0,enumerable:!0,value:n[u]}}},set(){throw new Error("Cannot set property on ProxyLens")},deleteProperty(){throw new Error("Cannot delete property on ProxyLens")}});return s},v=e=>{if(typeof e=="boolean")return(n,r)=>e?n!==r:!1;if(typeof e=="function")return e;if(Array.isArray(e)){const n=Object.fromEntries(e.map(r=>[r,!0]));return v(n)}return(n,r)=>{let o=!1,t=!1,s,c;if(Array.isArray(n)?(o=!0,s=n):s=[n],Array.isArray(r)?(t=!0,c=r):c=[r],t!==o||s.length!==c.length)return!0;for(let u=0;u<s.length;u++){const b=s[u],y=c[u];for(const p in e)if(v(e[p])(b[p],y[p]))return!0}return!1}},g=Symbol(),C=(e,n,r=!0)=>{const o=f.default.useRef(g),t=f.default.useRef(r),s=f.default.useRef(g);t.current!==r&&(s.current=g),t.current=r;const c=()=>{const y=o.current,p=n.get(e.getSnapshot());return Object.is(y,p)?y:y===g||(s.current===g&&(s.current=v(r)),s.current(y,p))?p:y},u=f.default.useSyncExternalStore(e.subscribe,c,c),b=f.default.useCallback(y=>e.update(F(n,y)),[e]);return o.current=u,[u,b]},E=Symbol(),G=()=>{const e=f.default.createContext(E);e.displayName="Lens(ExternalStoreContext)";const n=t=>s=>{const c=f.default.useContext(e);if(c===E)throw new Error("Cannot call `lens.use()` in a component outside of <LensProvider />");return C(c,t,s)},r=S({lens:P(),createUse:n}),o=t=>{const s=f.default.useRef();s.current||(s.current=O(t.value));const c=s.current;return f.default.useEffect(()=>{c.getSnapshot()!==t.value&&c.update(()=>t.value)},[t.value]),f.default.useEffect(()=>c.subscribe(()=>t.onChange(c.getSnapshot())),[t.onChange]),f.default.createElement(e.Provider,{value:c},t.children)};return o.displayName="Lens(Provider)",[r,o]},H=e=>{const n=O(e);return[S({lens:P(),createUse:t=>s=>C(n,t,s)}),{get current(){return n.getSnapshot()},set current(t){n.update(()=>t)}}]};a.stateful=H,a.stateless=G,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
var W=Object.defineProperty,q=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var A=Object.getOwnPropertySymbols;var X=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var R=(a,l,i)=>l in a?W(a,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[l]=i,v=(a,l)=>{for(var i in l||(l={}))X.call(l,i)&&R(a,i,l[i]);if(A)for(var i of A(l))Y.call(l,i)&&R(a,i,l[i]);return a},N=(a,l)=>q(a,z(l));(function(a,l){typeof exports=="object"&&typeof module!="undefined"?l(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],l):(a=typeof globalThis!="undefined"?globalThis:a||self,l(a.Concave={},a.React))})(this,function(a,l){"use strict";function i(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var f=i(l);const h=e=>Object.prototype.toString.call(e)==="[object Object]",j=e=>JSON.parse(JSON.stringify(e)),$=e=>h(e)?v({},e):Array.isArray(e)?[...e]:j(e),_=Object.freeze({get(e){return e},set(e,r){return r}}),w=()=>_,T=(e,r,n)=>({get(o){const t=e.get(o);return r(t)},set(o,t){const s=e.get(o);return e.set(o,n(s,t))}}),V=(e,r)=>T(e,n=>n[r],(n,o)=>{const t=$(n);return t[r]=o,t}),F=(e,r)=>n=>{const o=e.get(n),t=r(o);return Object.is(o,t)?n:e.set(n,r(o))},O=e=>{const r=new Set;let n=e;return{subscribe(o){return r.add(o),()=>r.delete(o)},getSnapshot(){return n},update(o){const t=o(n);Object.is(t,n)||(n=t,r.forEach(s=>s()))}}},d=Symbol(),P=Symbol();let m=!1,I=0;const K=()=>`$$ProxyLens(${I++})`,D=e=>Array.isArray(e)||h(e),J=(e,r)=>{const n=e.createUse(e.lens);return o=>{const[t,s]=n(o);return[L(t,r),s]}},L=(e,r)=>{if(!D(e))return e;if(Reflect.has(e,d))return Reflect.get(e,d);let n;const o=new Proxy(e,{get(t,s){if(s===d)return o;if(s==="toJSON")return n!=null||(n=()=>t),n;if(s==="toLens")return r[P];const c=t[s],u=r[s];return L(c,u)},ownKeys(t){return[...Reflect.ownKeys(t),"toLens","toJSON"]},getOwnPropertyDescriptor(t,s){return s===d?{enumerable:!1,value:o}:{configurable:!0,enumerable:!0,value:o[s]}},set(){throw new Error("Cannot set property on ProxyValue")},deleteProperty(){throw new Error("Cannot delete property on ProxyValue")}});return Object.defineProperty(e,d,{value:o,enumerable:!1}),o},x=e=>{const r={};let n,o,t;const s=new Proxy({},{get(c,u){if(u!=="$$typeof"){if(u==="$key")return t!=null||(t=K()),t;if(u===P)return o!=null||(o=()=>s),o;if(u==="use")return n!=null||(n=J(e,s)),n;if(r[u]===void 0){const b=N(v({},e),{lens:V(e.lens,u)}),y=x(b);r[u]=y}return r[u]}},ownKeys(c){return[...Object.keys(r),"$key","use"]},getOwnPropertyDescriptor(c,u){if(u==="$key"||u==="use")return{configurable:!0,enumerable:!0,value:s[u]};if(u in r){if(!m){m=!0;debugger;console.warn(`"%c${String(u)}" as a key on ProxyLens is only available because it has been previously accessed. If you are iterating through keys of this object via \`{ ...obj }\` or \`Object.assign({}, obj)\`, please consider an alternative approach.`,"color: red; font-weight: bold;")}return{configurable:!0,enumerable:!0,value:r[u]}}},set(){throw new Error("Cannot set property on ProxyLens")},deleteProperty(){throw new Error("Cannot delete property on ProxyLens")}});return s},S=e=>{if(typeof e=="boolean")return(r,n)=>e?r!==n:!1;if(typeof e=="function")return e;if(Array.isArray(e)){const r=Object.fromEntries(e.map(n=>[n,!0]));return S(r)}return(r,n)=>{let o=!1,t=!1,s,c;if(Array.isArray(r)?(o=!0,s=r):s=[r],Array.isArray(n)?(t=!0,c=n):c=[n],t!==o||s.length!==c.length)return!0;for(let u=0;u<s.length;u++){const b=s[u],y=c[u];for(const p in e)if(S(e[p])(b[p],y[p]))return!0}return!1}},g=Symbol(),C=(e,r,n=!0)=>{const o=f.default.useRef(g),t=f.default.useRef(n),s=f.default.useRef(g);t.current!==n&&(s.current=g),t.current=n;const c=()=>{const y=o.current,p=r.get(e.getSnapshot());return Object.is(y,p)?y:y===g||(s.current===g&&(s.current=S(n)),s.current(y,p))?p:y},u=f.default.useSyncExternalStore(e.subscribe,c,c),b=f.default.useCallback(y=>e.update(F(r,y)),[e]);return o.current=u,[u,b]},E=Symbol(),G=()=>{const e=f.default.createContext(E);e.displayName="Lens(ExternalStoreContext)";const r=t=>s=>{const c=f.default.useContext(e);if(c===E)throw new Error("Cannot call `lens.use()` in a component outside of <LensProvider />");return C(c,t,s)},n=x({lens:w(),createUse:r}),o=t=>{const s=f.default.useRef();s.current||(s.current=O(t.value));const c=s.current;return f.default.useEffect(()=>{c.getSnapshot()!==t.value&&c.update(()=>t.value)},[t.value]),f.default.useEffect(()=>c.subscribe(()=>t.onChange(c.getSnapshot())),[t.onChange]),f.default.createElement(e.Provider,{value:c},t.children)};return o.displayName="Lens(Provider)",[n,o]},H=e=>{const r=O(e);return[x({lens:w(),createUse:t=>s=>C(r,t,s)}),{get current(){return r.getSnapshot()},set current(t){r.update(()=>t)}}]};a.stateful=H,a.stateless=G,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
//# sourceMappingURL=concave.umd.js.map
{
"name": "concave",
"version": "0.0.8-alpha2",
"version": "0.0.8-alpha3",
"description": "A Lens-like interface for state management in React",

@@ -5,0 +5,0 @@ "main": "dist/concave.umd.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc