@chakra-ui/c-color-mode
Advanced tools
Comparing version 0.0.1-alpha.0 to 0.1.0-alpha.1
# @chakra-ui/c-color-mode | ||
## 0.0.1-alpha.0 | ||
## 0.1.0-alpha.1 | ||
### Minor Changes | ||
- [#49](https://github.com/chakra-ui/chakra-ui-vue-next/pull/49) [`cd4893b`](https://github.com/chakra-ui/chakra-ui-vue-next/commit/cd4893b6a27df39b59066c6e1d714b3830cf41bd) Thanks [@carwack](https://github.com/carwack)! - Add Iframe to Dom Element list | ||
### Patch Changes | ||
- [#42](https://github.com/chakra-ui/chakra-ui-vue-next/pull/42) [`ccae794`](https://github.com/chakra-ui/chakra-ui-vue-next/commit/ccae794937096c98b50dd5b72ac21856bd0e0e67) Thanks [@codebender828](https://github.com/codebender828)! - Extract Vue dependant utilities to "@chakra-ui/vue-utils" and consumes base utils from "@chakra-ui/utils@1.5.0" | ||
* [#50](https://github.com/chakra-ui/chakra-ui-vue-next/pull/50) [`082c70b`](https://github.com/chakra-ui/chakra-ui-vue-next/commit/082c70b03bd0e07704e1285592f515b3a43073b4) Thanks [@carwack](https://github.com/carwack)! - Add option to extend icons with custom icons | ||
## 0.0.1-alpha.0 | ||
### Patch Changes | ||
- [#36](https://github.com/chakra-ui/chakra-ui-vue-next/pull/36) [`8243ac6`](https://github.com/chakra-ui/chakra-ui-vue-next/commit/8243ac6cdc1ef47e56b3ec2f4635f44396273ee8) Thanks [@codebender828](https://github.com/codebender828)! - Initial release for core system packages | ||
@@ -9,0 +20,0 @@ |
@@ -12,6 +12,10 @@ "use strict"; | ||
var colorMode = (0, _vue.ref)(_colorMode); | ||
var colorMode = (0, _vue.isRef)(_colorMode) ? _colorMode : (0, _vue.ref)(_colorMode); | ||
var toggleColorMode = function toggleColorMode() { | ||
colorMode.value = 'light' ? colorMode.value = 'dark' : colorMode.value = 'light'; | ||
if (colorMode.value === 'light') { | ||
colorMode.value = 'dark'; | ||
} else { | ||
colorMode.value = 'light'; | ||
} | ||
}; | ||
@@ -18,0 +22,0 @@ |
@@ -9,3 +9,3 @@ "use strict"; | ||
var _vueUtils = require("@chakra-ui/vue-utils"); | ||
var _utils = require("@chakra-ui/utils"); | ||
@@ -22,4 +22,4 @@ var classNames = { | ||
classList: { | ||
add: _vueUtils.noop, | ||
remove: _vueUtils.noop | ||
add: _utils.noop, | ||
remove: _utils.noop | ||
} | ||
@@ -29,3 +29,3 @@ }; | ||
var getBody = function getBody() { | ||
return _vueUtils.isBrowser ? document.body : mockBody; | ||
return _utils.isBrowser ? document.body : mockBody; | ||
}; | ||
@@ -70,3 +70,3 @@ /** | ||
var isDark = (_getMediaQuery = getMediaQuery(queries.dark)) != null ? _getMediaQuery : fallback === 'dark'; | ||
var isDark = (_getMediaQuery = getMediaQuery(queries.dark)) != null ? _getMediaQuery : (fallback == null ? void 0 : fallback.value) === 'dark'; | ||
return isDark ? 'dark' : 'light'; | ||
@@ -82,3 +82,3 @@ } | ||
if (!('matchMedia' in window)) { | ||
return _vueUtils.noop; | ||
return _utils.noop; | ||
} | ||
@@ -104,4 +104,4 @@ | ||
set: function set(mode) { | ||
if (_vueUtils.isBrowser) { | ||
document.documentElement.style.setProperty('--chakra-ui-color-mode', mode); | ||
if (_utils.isBrowser) { | ||
document.documentElement.style.setProperty('--chakra-ui-color-mode', mode.value); | ||
} | ||
@@ -108,0 +108,0 @@ } |
@@ -6,3 +6,3 @@ "use strict"; | ||
var _vueUtils = require("@chakra-ui/vue-utils"); | ||
var _utils = require("@chakra-ui/utils"); | ||
@@ -28,3 +28,3 @@ var hasSupport = function hasSupport() { | ||
} catch (error) { | ||
if (_vueUtils.__DEV__) { | ||
if (_utils.__DEV__) { | ||
console.log(error); | ||
@@ -42,3 +42,3 @@ } | ||
} catch (error) { | ||
if (_vueUtils.__DEV__) { | ||
if (_utils.__DEV__) { | ||
console.log(error); | ||
@@ -45,0 +45,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { inject, ref } from 'vue'; | ||
import { inject, isRef, ref } from 'vue'; | ||
@@ -7,6 +7,10 @@ /** Injects color mode into component instance */ | ||
var colorMode = ref(_colorMode); | ||
var colorMode = isRef(_colorMode) ? _colorMode : ref(_colorMode); | ||
var toggleColorMode = () => { | ||
colorMode.value = 'light' ? colorMode.value = 'dark' : colorMode.value = 'light'; | ||
if (colorMode.value === 'light') { | ||
colorMode.value = 'dark'; | ||
} else { | ||
colorMode.value = 'light'; | ||
} | ||
}; | ||
@@ -13,0 +17,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { isBrowser, noop } from '@chakra-ui/vue-utils'; | ||
import { isBrowser, noop } from '@chakra-ui/utils'; | ||
var classNames = { | ||
@@ -51,3 +51,3 @@ light: 'chakra-ui-light', | ||
var isDark = (_getMediaQuery = getMediaQuery(queries.dark)) != null ? _getMediaQuery : fallback === 'dark'; | ||
var isDark = (_getMediaQuery = getMediaQuery(queries.dark)) != null ? _getMediaQuery : (fallback == null ? void 0 : fallback.value) === 'dark'; | ||
return isDark ? 'dark' : 'light'; | ||
@@ -81,3 +81,3 @@ } | ||
if (isBrowser) { | ||
document.documentElement.style.setProperty('--chakra-ui-color-mode', mode); | ||
document.documentElement.style.setProperty('--chakra-ui-color-mode', mode.value); | ||
} | ||
@@ -84,0 +84,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { __DEV__ } from '@chakra-ui/vue-utils'; | ||
import { __DEV__ } from '@chakra-ui/utils'; | ||
@@ -3,0 +3,0 @@ var hasSupport = () => typeof Storage !== 'undefined'; |
@@ -7,6 +7,7 @@ import { ColorMode } from './color-mode.utils'; | ||
} | ||
/** Injects color mode into component instance */ | ||
export declare const useColorMode: () => { | ||
colorMode: import("vue").Ref<ColorMode>; | ||
export declare type ColorModeContext = { | ||
colorMode: ColorMode; | ||
toggleColorMode: () => void; | ||
}; | ||
/** Injects color mode into component instance */ | ||
export declare const useColorMode: () => ColorModeContext; |
@@ -1,2 +0,3 @@ | ||
export declare type ColorMode = 'light' | 'dark'; | ||
import { Ref } from 'vue'; | ||
export declare type ColorMode = Ref<'light' | 'dark'>; | ||
/** | ||
@@ -19,4 +20,4 @@ * Function to add/remove class from `body` based on color mode | ||
export declare const root: { | ||
get: () => ColorMode; | ||
get: () => "light" | "dark"; | ||
set: (mode: ColorMode) => void; | ||
}; |
import { ColorMode } from './color-mode.utils'; | ||
export declare const storageKey = "chakra-ui-color-mode"; | ||
declare type MaybeColorMode = ColorMode | undefined; | ||
declare type MaybeColorMode = ColorMode['value'] | undefined; | ||
export interface StorageManager { | ||
get(init?: ColorMode): MaybeColorMode; | ||
set(value: ColorMode): void; | ||
get(init?: ColorMode['value']): MaybeColorMode; | ||
set(value: ColorMode['value']): void; | ||
type: 'cookie' | 'localStorage'; | ||
@@ -8,0 +8,0 @@ } |
{ | ||
"name": "@chakra-ui/c-color-mode", | ||
"version": "0.0.1-alpha.0", | ||
"version": "0.1.0-alpha.1", | ||
"main": "dist/cjs/index.js", | ||
@@ -14,11 +14,14 @@ "module": "dist/esm/index.js", | ||
], | ||
"exports": { | ||
".": { | ||
"require": "./dist/cjs/index.js", | ||
"default": "./dist/esm/index.js" | ||
} | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/chakra-ui/chakra-ui-vue-next.git" | ||
}, | ||
"repository": "https://github.com/chakra-ui/chakra-ui-vue-next/tree/master/packages/c-color-mode", | ||
"bugs": { | ||
"url": "https://github.com/chakra-ui/chakra-ui=vue-next/issues" | ||
"url": "https://github.com/chakra-ui/chakra-ui-vue-next/issues" | ||
}, | ||
@@ -37,7 +40,10 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@chakra-ui/vue-utils": "^0.0.1-alpha.0" | ||
"@chakra-ui/utils": "^1.5.0" | ||
}, | ||
"peerDependencies": { | ||
"vue": ">=3.0.5" | ||
}, | ||
"devDependencies": { | ||
"vue": ">=3.0.5" | ||
} | ||
} |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
33718
373
0
1
1
+ Added@chakra-ui/utils@^1.5.0
+ Added@chakra-ui/utils@1.10.4(transitive)
+ Addedframesync@5.3.0(transitive)
+ Addedmagic-string@0.30.13(transitive)
+ Addednanoid@3.3.7(transitive)
+ Addedtslib@2.8.1(transitive)
- Removed@chakra-ui/vue-utils@^0.0.1-alpha.0
- Removed@chakra-ui/vue-utils@0.0.1-alpha.0(transitive)
- Removed@types/object-assign@4.0.30(transitive)
- Removedmagic-string@0.30.14(transitive)
- Removednanoid@3.3.8(transitive)
- Removedobject-assign@4.1.1(transitive)