@blac/react
Advanced tools
Comparing version 0.0.15 to 0.0.16
import { Blac } from 'blac'; | ||
import React, { createContext, useMemo, useContext, useSyncExternalStore } from 'react'; | ||
// import { BlocConstructor } from "blac"; | ||
// export interface ProviderItem { | ||
// id: string; | ||
// parent?: string; | ||
// bloc: BlocBase<any>; | ||
// } | ||
// interface ProviderOptions<B> { | ||
// bloc: BlocConstructor<B>; | ||
// debug?: boolean; | ||
// } | ||
class BlacReact { | ||
@@ -29,5 +19,6 @@ static pluginKey = "blacReact"; | ||
static getInstance(throwError = true) { | ||
const blac = globalThis.blac; | ||
// const blac = (globalThis as any).blac; | ||
const blac = BlacContext._currentValue; | ||
if (!blac) { | ||
throw new Error("BlacReact: blac instance not found"); | ||
throw new Error("BlacReact: blac instance not found, the <BlacApp> provider component might be missing"); | ||
} | ||
@@ -41,3 +32,3 @@ const blacReact = blac.getPluginKey(BlacReact.pluginKey); | ||
setup() { | ||
globalThis.blac = this.blac; | ||
// (globalThis as any).blac = this.blac; | ||
this.blac.addPluginKey(BlacReact.pluginKey, this); | ||
@@ -44,0 +35,0 @@ } |
@@ -6,12 +6,2 @@ 'use strict'; | ||
// import { BlocConstructor } from "blac"; | ||
// export interface ProviderItem { | ||
// id: string; | ||
// parent?: string; | ||
// bloc: BlocBase<any>; | ||
// } | ||
// interface ProviderOptions<B> { | ||
// bloc: BlocConstructor<B>; | ||
// debug?: boolean; | ||
// } | ||
class BlacReact { | ||
@@ -32,5 +22,6 @@ static pluginKey = "blacReact"; | ||
static getInstance(throwError = true) { | ||
const blac = globalThis.blac; | ||
// const blac = (globalThis as any).blac; | ||
const blac = BlacContext._currentValue; | ||
if (!blac) { | ||
throw new Error("BlacReact: blac instance not found"); | ||
throw new Error("BlacReact: blac instance not found, the <BlacApp> provider component might be missing"); | ||
} | ||
@@ -44,3 +35,3 @@ const blacReact = blac.getPluginKey(BlacReact.pluginKey); | ||
setup() { | ||
globalThis.blac = this.blac; | ||
// (globalThis as any).blac = this.blac; | ||
this.blac.addPluginKey(BlacReact.pluginKey, this); | ||
@@ -47,0 +38,0 @@ } |
{ | ||
"name": "@blac/react", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"license": "MIT", | ||
@@ -36,2 +36,3 @@ "main": "dist/blac-react.js", | ||
"@vitejs/plugin-react": "^4.0.3", | ||
"highlight.js": "^11.8.0", | ||
"react": "^18.2.0", | ||
@@ -38,0 +39,0 @@ "react-dom": "^18.2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
9735
10
242