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

@radix-ui/react-context

Package Overview
Dependencies
Maintainers
6
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-context - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1-rc.1

21

dist/index.d.ts

@@ -1,10 +0,6 @@

import * as react_jsx_runtime from 'react/jsx-runtime';
import * as React from 'react';
declare function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType): readonly [{
(props: ContextValueType & {
children: React.ReactNode;
}): react_jsx_runtime.JSX.Element;
displayName: string;
}, (consumerName: string) => ContextValueType];
declare function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType): readonly [React.FC<ContextValueType & {
children: React.ReactNode;
}>, (consumerName: string) => ContextValueType];
type Scope<C = any> = {

@@ -20,10 +16,7 @@ [scopeName: string]: React.Context<C>[];

}
declare function createContextScope(scopeName: string, createContextScopeDeps?: CreateScope[]): readonly [<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType | undefined) => readonly [{
(props: ContextValueType & {
scope: Scope<ContextValueType>;
children: React.ReactNode;
}): react_jsx_runtime.JSX.Element;
displayName: string;
}, (consumerName: string, scope: Scope<ContextValueType | undefined>) => ContextValueType], CreateScope];
declare function createContextScope(scopeName: string, createContextScopeDeps?: CreateScope[]): readonly [<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType | undefined) => readonly [React.FC<ContextValueType & {
scope: Scope<ContextValueType>;
children: React.ReactNode;
}>, (consumerName: string, scope: Scope<ContextValueType | undefined>) => ContextValueType], CreateScope];
export { type CreateScope, type Scope, createContext, createContextScope };

@@ -43,7 +43,8 @@ "use strict";

const Context = React.createContext(defaultContext);
function Provider(props) {
const Provider = (props) => {
const { children, ...context } = props;
const value = React.useMemo(() => context, Object.values(context));
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children });
}
};
Provider.displayName = rootComponentName + "Provider";
function useContext2(consumerName) {

@@ -55,3 +56,2 @@ const context = React.useContext(Context);

}
Provider.displayName = rootComponentName + "Provider";
return [Provider, useContext2];

@@ -65,3 +65,3 @@ }

defaultContexts = [...defaultContexts, defaultContext];
function Provider(props) {
const Provider = (props) => {
const { scope, children, ...context } = props;

@@ -71,3 +71,4 @@ const Context = scope?.[scopeName][index] || BaseContext;

return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children });
}
};
Provider.displayName = rootComponentName + "Provider";
function useContext2(consumerName, scope) {

@@ -80,3 +81,2 @@ const Context = scope?.[scopeName][index] || BaseContext;

}
Provider.displayName = rootComponentName + "Provider";
return [Provider, useContext2];

@@ -83,0 +83,0 @@ }

{
"name": "@radix-ui/react-context",
"version": "1.1.0",
"version": "1.1.1-rc.1",
"license": "MIT",

@@ -46,3 +46,4 @@ "exports": {

"url": "https://github.com/radix-ui/primitives/issues"
}
},
"stableVersion": "1.1.0"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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