@vueless/storybook-dark-mode 9.0.8 → 9.0.10
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/README.md +2 -1
- package/dist/cjs/index.js +3 -1
- package/dist/esm/index.js +3 -1
- package/package.json +2 -2
- package/src/index.tsx +1 -1
package/README.md
CHANGED
|
@@ -262,6 +262,7 @@ export const decorators = [
|
|
|
262
262
|
Docs have a dedicated container component which will _not_ be themed unless you explicitly configure it:
|
|
263
263
|
|
|
264
264
|
```js
|
|
265
|
+
import { DocsContainer } from '@storybook/addon-docs/blocks';
|
|
265
266
|
import { useIsDarkMode } from './hooks'; // the hook we defined above
|
|
266
267
|
|
|
267
268
|
function ThemedDocsContainer(props) {
|
|
@@ -290,7 +291,7 @@ By editing your `.storybook/preview.js`.
|
|
|
290
291
|
```js
|
|
291
292
|
import React from 'react';
|
|
292
293
|
import { addons } from 'storybook/preview-api';
|
|
293
|
-
import { DocsContainer } from '@storybook/addon-docs';
|
|
294
|
+
import { DocsContainer } from '@storybook/addon-docs/blocks';
|
|
294
295
|
import { themes } from 'storybook/theming';
|
|
295
296
|
|
|
296
297
|
import {
|
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)(
|
|
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(
|
|
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.
|
|
3
|
+
"version": "9.0.10",
|
|
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",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"storybook": "^9.1.3",
|
|
68
68
|
"ts-node": "^10.9.2",
|
|
69
69
|
"typescript": "^5.9.2",
|
|
70
|
-
"vite": "^7.1.
|
|
70
|
+
"vite": "^7.1.11"
|
|
71
71
|
},
|
|
72
72
|
"auto": {
|
|
73
73
|
"extends": "hipstersmoothie"
|
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();
|