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
0
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.51 to 0.0.52

2

index.cjs.js

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

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

@@ -1,16 +0,16 @@

var I = Object.defineProperty;
var v = (t, e, s) => e in t ? I(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
var g = (t, e, s) => v(t, typeof e != "symbol" ? e + "" : e, s);
import { Blac as K } from "blac";
import { useId as x, useMemo as h, useSyncExternalStore as E, useLayoutEffect as j } from "react";
const w = (t, e) => ({
subscribe: (s) => {
const n = t.addSubscriber({
var v = Object.defineProperty;
var x = (s, e, t) => e in s ? v(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
var i = (s, e, t) => x(s, typeof e != "symbol" ? e + "" : e, t);
import { Blac as h } from "blac";
import { useId as E, useMemo as U, useSyncExternalStore as j, useLayoutEffect as w } from "react";
const k = (s, e) => ({
subscribe: (t) => {
const n = s.addSubscriber({
fn: () => {
try {
s(t.state);
} catch (d) {
t(s.state);
} catch (a) {
console.error({
e: d,
bloc: t,
e: a,
bloc: s,
dependencyArray: e

@@ -26,57 +26,57 @@ });

},
getSnapshot: () => t.state,
getServerSnapshot: () => t.state
}), o = class o {
static useBloc(e, s) {
const n = x(), d = o.getUsedKeys(n);
let i = (r) => {
getSnapshot: () => s.state,
getServerSnapshot: () => s.state
}), c = class c {
static useBloc(e, t) {
const n = E(), a = c.getUsedKeys(n);
let f = t != null && t.inferStateUsage ? (r) => {
if (typeof r != "object")
return [r];
const c = [];
for (const p of d)
p in r && c.push(r[p]);
return c;
}, f, y;
typeof s == "object" && (i = s.dependencySelector ?? i, f = s.id, y = s.props ?? y), e.isolated && (f = n);
const a = K.getInstance().getBloc(e, {
id: f,
props: y,
const d = [];
for (const K of a)
K in r && d.push(r[K]);
return d;
} : (r) => [r], y, g;
typeof t == "object" && (f = t.dependencySelector ?? f, y = t.id, g = t.props ?? g), e.isolated && (y = n);
const u = h.getInstance().getBloc(e, {
id: y,
props: g,
reconnect: !1
});
if (!a)
if (!u)
throw new Error(`useBloc: could not resolve: ${e.name || e}`);
const { subscribe: b, getSnapshot: m, getServerSnapshot: B } = h(
() => w(a, i),
[a.createdAt]
), u = E(
const { subscribe: b, getSnapshot: m, getServerSnapshot: B } = U(
() => k(u, f),
[u.createdAt]
), o = j(
b,
m,
B
), l = /* @__PURE__ */ new Set(), U = h(() => {
), l = /* @__PURE__ */ new Set(), I = U(() => {
try {
if (typeof u == "object")
return new Proxy(u, {
get(r, c) {
return d.add(c), l.add(c), Reflect.get(r, c);
if (t != null && t.inferStateUsage && typeof o == "object")
return new Proxy(o, {
get(r, d) {
return a.add(d), l.add(d), Reflect.get(r, d);
}
});
} catch (r) {
K.instance.log("useBloc Error", r);
h.instance.log("useBloc Error", r);
}
return u;
}, [u]);
return j(() => {
o.getUsedKeys(n).clear();
return o;
}, [o]);
return w(() => {
c.getUsedKeys(n).clear();
for (const r of l)
o.getUsedKeys(n).add(r);
}, [l, n]), [U, a];
c.getUsedKeys(n).add(r);
}, [l, n]), [I, u];
}
};
g(o, "ridUsedKeys", /* @__PURE__ */ new Map()), g(o, "getUsedKeys", (e) => (o.ridUsedKeys.has(e) || o.ridUsedKeys.set(e, /* @__PURE__ */ new Set()), o.ridUsedKeys.get(e)));
let S = o;
const P = S.useBloc;
i(c, "ridUsedKeys", /* @__PURE__ */ new Map()), i(c, "getUsedKeys", (e) => (c.ridUsedKeys.has(e) || c.ridUsedKeys.set(e, /* @__PURE__ */ new Set()), c.ridUsedKeys.get(e)));
let S = c;
const $ = S.useBloc;
export {
w as externalBlocStore,
P as useBloc
k as externalBlocStore,
$ as useBloc
};
//# sourceMappingURL=index.es.js.map
{
"name": "@blac/react",
"version": "0.0.51",
"version": "0.0.52",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "index.cjs.js",

@@ -11,2 +11,3 @@ import { BlocConstructor, BlocGeneric, BlocHookDependencyArrayFn, BlocState, InferPropsFromGeneric } from 'blac';

props?: InferPropsFromGeneric<B>;
inferStateUsage?: boolean;
}

@@ -13,0 +14,0 @@ export declare class UseBlocClass {

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