@vueless/storybook-dark-mode 9.0.8 → 9.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -31,7 +31,9 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
31
31
  * Returns the current state of storybook's dark-mode
32
32
  */
33
33
  function useDarkMode() {
34
- var _useState = (0, _previewApi.useState)((0, _Tool.store)().current === 'dark'),
34
+ var _useState = (0, _previewApi.useState)(function () {
35
+ return (0, _Tool.store)().current === 'dark';
36
+ }),
35
37
  _useState2 = _slicedToArray(_useState, 2),
36
38
  isDark = _useState2[0],
37
39
  setIsDark = _useState2[1];
package/dist/esm/index.js CHANGED
@@ -12,7 +12,9 @@ import { store } from './Tool';
12
12
  * Returns the current state of storybook's dark-mode
13
13
  */
14
14
  export function useDarkMode() {
15
- var _useState = useState(store().current === 'dark'),
15
+ var _useState = useState(function () {
16
+ return store().current === 'dark';
17
+ }),
16
18
  _useState2 = _slicedToArray(_useState, 2),
17
19
  isDark = _useState2[0],
18
20
  setIsDark = _useState2[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueless/storybook-dark-mode",
3
- "version": "9.0.8",
3
+ "version": "9.0.9",
4
4
  "description": "Toggle between light and dark mode in Storybook",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/index.tsx CHANGED
@@ -6,7 +6,7 @@ import { store } from './Tool';
6
6
  * Returns the current state of storybook's dark-mode
7
7
  */
8
8
  export function useDarkMode(): boolean {
9
- const [isDark, setIsDark] = useState(store().current === 'dark');
9
+ const [isDark, setIsDark] = useState(() => store().current === 'dark');
10
10
 
11
11
  useEffect(() => {
12
12
  const chan = addons.getChannel();