New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@blac/react

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blac/react - npm Package Compare versions

Comparing version 0.0.46 to 0.0.49

2

index.cjs.js

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

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("blac"),S=require("react"),y=(c,t)=>{let r=t(c.state);return{subscribe:d=>{const u=c.addSubscriber(n=>{try{const e=t(n)??[];let o=!0;for(let l=0;l<e.length;l++)if(e[l]!==r[l]){o=!1;break}o||(r=e,d())}catch(e){console.error({e,bloc:c,dependencyArray:t,lastDependencyCheck:r})}});return()=>{u()}},getSnapshot:()=>c.state,getServerSnapshot:()=>c.state}};class I{static useBloc(t,r){const d=S.useId(),u=[];let n=s=>{if(typeof s!="object")return[s];const a=[];for(const g in s)u.includes(g)&&a.push(s[g]);return a},e,o;typeof r=="object"&&(n=r.dependencySelector??n,e=r.id,o=r.props??o),t.isolated&&(e=d);const i=h.Blac.getInstance().getBloc(t,{id:e,props:o,reconnect:!1});if(!i)throw new Error(`useBloc: could not resolve: ${t.name||t}`);const{subscribe:p,getSnapshot:b,getServerSnapshot:v}=S.useMemo(()=>y(i,n),[i.createdAt]),f=S.useSyncExternalStore(p,b,v);let B=f;try{typeof f=="object"&&(B=new Proxy(f,{get(s,a){return u.push(a),Reflect.get(s,a)}}))}catch(s){h.Blac.instance.log("useBloc Error",s)}return[B,i]}}const j=I.useBloc;exports.externalBlocStore=y;exports.useBloc=j;
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("blac"),d=require("react"),b=(n,e)=>({subscribe:o=>{const r=n.addSubscriber({fn:()=>{try{o(n.state)}catch(u){console.error({e:u,bloc:n,dependencyArray:e})}},dependencyArray:e});return()=>{r()}},getSnapshot:()=>n.state,getServerSnapshot:()=>n.state}),s=class s{static useBloc(e,o){const r=d.useId(),u=s.getUsedKeys(r);let l=t=>{if(typeof t!="object")return[t];const c=[];for(const h of u)h in t&&c.push(t[h]);return c},y,f;typeof o=="object"&&(l=o.dependencySelector??l,y=o.id,f=o.props??f),e.isolated&&(y=r);const a=K.Blac.getInstance().getBloc(e,{id:y,props:f,reconnect:!1});if(!a)throw new Error(`useBloc: could not resolve: ${e.name||e}`);const{subscribe:B,getSnapshot:p,getServerSnapshot:U}=d.useMemo(()=>b(a,l),[a.createdAt]),i=d.useSyncExternalStore(B,p,U),g=new Set,v=d.useMemo(()=>{try{if(typeof i=="object")return new Proxy(i,{get(t,c){return u.add(c),g.add(c),Reflect.get(t,c)}})}catch(t){K.Blac.instance.log("useBloc Error",t)}return i},[i]);return d.useLayoutEffect(()=>{s.getUsedKeys(r).clear();for(const t of g)s.getUsedKeys(r).add(t)},[g,r]),[v,a]}};s.ridUsedKeys=new Map,s.getUsedKeys=e=>(s.ridUsedKeys.has(e)||s.ridUsedKeys.set(e,new Set),s.ridUsedKeys.get(e));let S=s;const I=S.useBloc;exports.externalBlocStore=b;exports.useBloc=I;
//# sourceMappingURL=index.cjs.js.map
import { Blac as h } from "blac";
import { useId as b, useMemo as m, useSyncExternalStore as I } from "react";
const k = (o, t) => {
let s = t(o.state);
return {
subscribe: (d) => {
const u = o.addSubscriber((n) => {
import { useId as U, useMemo as p, useSyncExternalStore as I, useLayoutEffect as v } from "react";
const x = (c, e) => ({
subscribe: (o) => {
const r = c.addSubscriber({
fn: () => {
try {
const e = t(n) ?? [];
let c = !0;
for (let l = 0; l < e.length; l++)
if (e[l] !== s[l]) {
c = !1;
break;
}
c || (s = e, d());
} catch (e) {
o(c.state);
} catch (d) {
console.error({
e,
bloc: o,
dependencyArray: t,
lastDependencyCheck: s
e: d,
bloc: c,
dependencyArray: e
});
}
});
return () => {
u();
};
},
getSnapshot: () => o.state,
getServerSnapshot: () => o.state
};
};
class v {
static useBloc(t, s) {
const d = b(), u = [];
let n = (r) => {
if (typeof r != "object")
return [r];
const a = [];
for (const S in r)
u.includes(S) && a.push(r[S]);
return a;
}, e, c;
typeof s == "object" && (n = s.dependencySelector ?? n, e = s.id, c = s.props ?? c), t.isolated && (e = d);
const i = h.getInstance().getBloc(t, {
id: e,
props: c,
},
dependencyArray: e
});
return () => {
r();
};
},
getSnapshot: () => c.state,
getServerSnapshot: () => c.state
}), s = class s {
static useBloc(e, o) {
const r = U(), d = s.getUsedKeys(r);
let i = (t) => {
if (typeof t != "object")
return [t];
const n = [];
for (const S of d)
S in t && n.push(t[S]);
return n;
}, f, y;
typeof o == "object" && (i = o.dependencySelector ?? i, f = o.id, y = o.props ?? y), e.isolated && (f = r);
const a = h.getInstance().getBloc(e, {
id: f,
props: y,
reconnect: !1
});
if (!i)
throw new Error(`useBloc: could not resolve: ${t.name || t}`);
const { subscribe: g, getSnapshot: y, getServerSnapshot: B } = m(
() => k(i, n),
[i.createdAt]
), f = I(
g,
y,
B
);
let p = f;
try {
typeof f == "object" && (p = new Proxy(f, {
get(r, a) {
return u.push(a), Reflect.get(r, a);
}
}));
} catch (r) {
h.instance.log("useBloc Error", r);
}
return [p, i];
if (!a)
throw new Error(`useBloc: could not resolve: ${e.name || e}`);
const { subscribe: K, getSnapshot: b, getServerSnapshot: m } = p(
() => x(a, i),
[a.createdAt]
), u = I(
K,
b,
m
), l = /* @__PURE__ */ new Set(), B = p(() => {
try {
if (typeof u == "object")
return new Proxy(u, {
get(t, n) {
return d.add(n), l.add(n), Reflect.get(t, n);
}
});
} catch (t) {
h.instance.log("useBloc Error", t);
}
return u;
}, [u]);
return v(() => {
s.getUsedKeys(r).clear();
for (const t of l)
s.getUsedKeys(r).add(t);
}, [l, r]), [B, a];
}
}
const j = v.useBloc;
};
s.ridUsedKeys = /* @__PURE__ */ new Map(), s.getUsedKeys = (e) => (s.ridUsedKeys.has(e) || s.ridUsedKeys.set(e, /* @__PURE__ */ new Set()), s.ridUsedKeys.get(e));
let g = s;
const M = g.useBloc;
export {
k as externalBlocStore,
j as useBloc
x as externalBlocStore,
M as useBloc
};
//# sourceMappingURL=index.es.js.map
{
"name": "@blac/react",
"version": "0.0.46",
"version": "0.0.49",
"license": "MIT",

@@ -24,3 +24,4 @@ "main": "index.cjs.js",

"prettier": "prettier --write ./src",
"test": "vitest run --coverage",
"test": "vitest --config vitest.config.ts",
"test:watch": "vitest --watch --config vitest.config.ts",
"pub": "npm run build && npm publish"

@@ -32,7 +33,14 @@ },

"devDependencies": {
"@types/react": "^18.2.69",
"react": "^18.2.0",
"vite-plugin-dts": "^3.7.3",
"vitest": "^1.4.0"
"@testing-library/dom": "^10.1.0",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitest/browser": "^1.6.0",
"jsdom": "^24.1.0",
"react": "^18.3.1",
"vite-plugin-dts": "^3.9.1",
"vitest": "^1.6.0"
}
}

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