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

@rescui/ui-contexts

Package Overview
Dependencies
Maintainers
0
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rescui/ui-contexts - npm Package Compare versions

Comparing version 0.4.4 to 0.5.0

2

lib/index.d.ts
export { LayeringConsumer, withLayering, useLayeringContext } from './parts/layering-context';
export { default as LayeringProvider } from './layering-provider';
export type { LayeringProviderProps } from './layering-provider';
export { ThemeConsumer, withTheme, useTheme, getInverseTheme } from './parts/theme-context';
export { ThemeConsumer, ThemeContext, withTheme, useTheme, useThemeWithUndefined, getInverseTheme } from './parts/theme-context';
export { default as ThemeProvider } from './theme-provider';
export type { ThemeProviderProps } from './theme-provider';
export type { Theme } from './parts/theme-context';
export { LayeringConsumer, useLayeringContext, withLayering } from './parts/layering-context.js';
export { default as LayeringProvider } from './layering-provider.js';
export { ThemeConsumer, getInverseTheme, useTheme, withTheme } from './parts/theme-context.js';
export { ThemeConsumer, ThemeContext, getInverseTheme, useTheme, useThemeWithUndefined, withTheme } from './parts/theme-context.js';
export { default as ThemeProvider } from './theme-provider.js';
import React, { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
export declare type Theme = 'light' | 'dark';
export declare const ThemeContext: React.Context<Theme>;
export declare const ThemeConsumer: React.Consumer<Theme>;
declare type ThemeContextValue = {
theme: Theme;
noProvider?: boolean;
};
export declare const ThemeContext: React.Context<ThemeContextValue>;
export declare const ThemeConsumer: React.Consumer<ThemeContextValue>;
export declare const getInverseTheme: (theme: Theme) => Theme;
/**
* @deprecated please support --rs-theme-dark and --rs-theme-flip css variables and don't use react context for theme
* If you need to maintain backward compatibility use `useThemeWithUndefined` hook instead, rely on --rs-theme-dark and --rs-theme-flip css variables when theme is undefined
* */
export declare const useTheme: (overwriteValue?: Theme) => Theme;
export declare const useThemeWithUndefined: (overwriteValue?: Theme) => Theme | undefined;
export interface ThemeProps {

@@ -11,4 +20,6 @@ theme?: Theme;

/**
* @deprecated use `useTheme` hook instead
* @deprecated please support --rs-theme-dark and --rs-theme-flip css variables and don't use react context for theme
* If you need to maintain backward compatibility use `useThemeWithUndefined` hook instead, rely on --rs-theme-dark and --rs-theme-flip css variables when theme is undefined
* */
export declare const withTheme: <P extends ThemeProps = ThemeProps>(wrappedComponent: React.ComponentType<P>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<unknown>>;
export {};

@@ -18,3 +18,6 @@ import "core-js/modules/es.object.to-string.js";

import React, { createContext, useContext } from 'react';
var ThemeContext = /*#__PURE__*/createContext('light');
var ThemeContext = /*#__PURE__*/createContext({
theme: 'light',
noProvider: true
});
var ThemeConsumer = ThemeContext.Consumer;

@@ -25,9 +28,25 @@

};
/**
* @deprecated please support --rs-theme-dark and --rs-theme-flip css variables and don't use react context for theme
* If you need to maintain backward compatibility use `useThemeWithUndefined` hook instead, rely on --rs-theme-dark and --rs-theme-flip css variables when theme is undefined
* */
var useTheme = function useTheme(overwriteValue) {
var themeFromContext = useContext(ThemeContext);
return overwriteValue || themeFromContext;
var _useContext = useContext(ThemeContext),
theme = _useContext.theme;
return overwriteValue || theme;
};
var useThemeWithUndefined = function useThemeWithUndefined(overwriteValue) {
var _useContext2 = useContext(ThemeContext),
theme = _useContext2.theme,
noProvider = _useContext2.noProvider;
return overwriteValue || (noProvider ? undefined : theme);
};
/**
* @deprecated use `useTheme` hook instead
* @deprecated please support --rs-theme-dark and --rs-theme-flip css variables and don't use react context for theme
* If you need to maintain backward compatibility use `useThemeWithUndefined` hook instead, rely on --rs-theme-dark and --rs-theme-flip css variables when theme is undefined
* */

@@ -42,3 +61,4 @@

return /*#__PURE__*/React.createElement(ThemeConsumer, null, function (themeFromContext) {
return /*#__PURE__*/React.createElement(ThemeConsumer, null, function (_ref2) {
var themeFromContext = _ref2.theme;
return /*#__PURE__*/React.createElement(WrappedComponent, _objectSpread({

@@ -54,2 +74,2 @@ ref: ref,

export { ThemeConsumer, ThemeContext, getInverseTheme, useTheme, withTheme };
export { ThemeConsumer, ThemeContext, getInverseTheme, useTheme, useThemeWithUndefined, withTheme };

@@ -6,10 +6,12 @@ import React from 'react';

theme: Theme;
ignoreThemeValueForCSSApi?: boolean;
children?: React.ReactNode;
};
declare const ThemeProvider: {
({ theme, children }: ThemeProviderProps): JSX.Element;
({ theme, children, ignoreThemeValueForCSSApi }: ThemeProviderProps): JSX.Element;
propTypes: {
theme: PropTypes.Validator<string>;
ignoreThemeValueForCSSApi: PropTypes.Requireable<boolean>;
};
};
export default ThemeProvider;

@@ -7,5 +7,10 @@ import React from 'react';

var theme = _ref.theme,
children = _ref.children;
children = _ref.children,
_ref$ignoreThemeValue = _ref.ignoreThemeValueForCSSApi,
ignoreThemeValueForCSSApi = _ref$ignoreThemeValue === void 0 ? false : _ref$ignoreThemeValue;
return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
value: theme
value: {
theme: theme,
noProvider: ignoreThemeValueForCSSApi
}
}, children);

@@ -15,4 +20,5 @@ };

ThemeProvider.propTypes = {
theme: PropTypes.oneOf(['light', 'dark']).isRequired
theme: PropTypes.oneOf(['light', 'dark']).isRequired,
ignoreThemeValueForCSSApi: PropTypes.bool
};
export { ThemeProvider as default };
{
"name": "@rescui/ui-contexts",
"version": "0.4.4",
"version": "0.5.0",
"description": "",

@@ -26,3 +26,3 @@ "license": "Apache-2.0",

"devDependencies": {
"@rescui/scripts": "^0.2.3"
"@rescui/scripts": "^0.3.0"
},

@@ -32,3 +32,3 @@ "scripts": {

},
"gitHead": "e21b6f80037993b094ceaff022db6d4cd176a88d"
"gitHead": "51da8a7188f4c558c563065a4ff4ef5c8e74994c"
}
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