Socket
Socket
Sign inDemoInstall

@chakra-ui/color-mode

Package Overview
Dependencies
Maintainers
4
Versions
363
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chakra-ui/color-mode - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

17

CHANGELOG.md
# Change Log
## 1.0.7
### Patch Changes
- [`9dc37ee37`](https://github.com/chakra-ui/chakra-ui/commit/9dc37ee37575650746e9b006e41428f1bf53e16c)
[#3280](https://github.com/chakra-ui/chakra-ui/pull/3280) Thanks
[@segunadebayo](https://github.com/segunadebayo)! - Fix issue where reading
from localStorage maybe fail due to several reasons (SecurityError, Uncaught
DOMException, TypeError, etc.)
- Updated dependencies
[[`ff4a36bca`](https://github.com/chakra-ui/chakra-ui/commit/ff4a36bca11cc177830f6f1da13700acd1e3a087),
[`483687237`](https://github.com/chakra-ui/chakra-ui/commit/483687237f2c4fed05dc6a79693f307c601c1285),
[`61962345c`](https://github.com/chakra-ui/chakra-ui/commit/61962345c5b1c862445c16c586e304b28c376c9a)]:
- @chakra-ui/utils@1.2.0
- @chakra-ui/hooks@1.1.4
## 1.0.6

@@ -4,0 +21,0 @@

33

dist/cjs/storage-manager.js

@@ -5,3 +5,9 @@ "use strict";

exports.cookieStorageManager = exports.localStorageManager = exports.storageKey = void 0;
var hasLocalStorage = typeof Storage !== "undefined";
var _utils = require("@chakra-ui/utils");
var hasSupport = function hasSupport() {
return typeof Storage !== "undefined";
};
var storageKey = "chakra-ui-color-mode";

@@ -15,12 +21,25 @@ exports.storageKey = storageKey;

get: function get(init) {
if (!hasLocalStorage) {
if (!hasSupport()) return init;
try {
var _value = localStorage.getItem(storageKey);
return _value != null ? _value : init;
} catch (error) {
if (_utils.__DEV__) {
console.log(error);
}
return init;
}
var maybeValue = window.localStorage.getItem(storageKey);
return maybeValue != null ? maybeValue : init;
},
set: function set(value) {
if (hasLocalStorage) {
window.localStorage.setItem(storageKey, value);
if (!hasSupport()) return;
try {
localStorage.setItem(storageKey, value);
} catch (error) {
if (_utils.__DEV__) {
console.log(error);
}
}

@@ -27,0 +46,0 @@ },

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

var hasLocalStorage = typeof Storage !== "undefined";
import { __DEV__ } from "@chakra-ui/utils";
var hasSupport = () => typeof Storage !== "undefined";
export var storageKey = "chakra-ui-color-mode";

@@ -9,13 +12,26 @@

get(init) {
if (!hasLocalStorage) {
if (!hasSupport()) return init;
try {
var _value = localStorage.getItem(storageKey);
return _value != null ? _value : init;
} catch (error) {
if (__DEV__) {
console.log(error);
}
return init;
}
var maybeValue = window.localStorage.getItem(storageKey);
return maybeValue != null ? maybeValue : init;
},
set(value) {
if (hasLocalStorage) {
window.localStorage.setItem(storageKey, value);
if (!hasSupport()) return;
try {
localStorage.setItem(storageKey, value);
} catch (error) {
if (__DEV__) {
console.log(error);
}
}

@@ -22,0 +38,0 @@ },

import { ColorMode } from "./color-mode.utils";
export declare const storageKey = "chakra-ui-color-mode";
declare type MaybeColorMode = ColorMode | undefined;
export interface StorageManager {
get(init?: ColorMode): ColorMode | undefined;
get(init?: ColorMode): MaybeColorMode;
set(value: ColorMode): void;

@@ -16,1 +17,2 @@ type: "cookie" | "localStorage";

export declare const cookieStorageManager: (cookies?: string) => StorageManager;
export {};
{
"name": "@chakra-ui/color-mode",
"version": "1.0.6",
"version": "1.0.7",
"description": "React component and hooks for handling light and dark mode.",

@@ -60,4 +60,4 @@ "keywords": [

"dependencies": {
"@chakra-ui/hooks": "1.1.3",
"@chakra-ui/utils": "1.1.0"
"@chakra-ui/hooks": "1.1.4",
"@chakra-ui/utils": "1.2.0"
},

@@ -64,0 +64,0 @@ "peerDependencies": {

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