@vueless/storybook-dark-mode 10.0.1 → 10.0.3-beta.0
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/index.js +3 -3
- package/dist/manager.js +3 -3
- package/package.json +8 -8
- package/src/store.ts +3 -3
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react';
|
|
|
2
2
|
import { addons } from 'storybook/preview-api';
|
|
3
3
|
import { global } from '@storybook/global';
|
|
4
4
|
import { themes } from 'storybook/theming';
|
|
5
|
-
import
|
|
5
|
+
import { isEqual } from 'lodash-es';
|
|
6
6
|
|
|
7
7
|
// src/index.tsx
|
|
8
8
|
|
|
@@ -53,11 +53,11 @@ var store = (userTheme = {}) => {
|
|
|
53
53
|
if (typeof storedItem === "string") {
|
|
54
54
|
const stored = JSON.parse(storedItem);
|
|
55
55
|
if (userTheme) {
|
|
56
|
-
if (userTheme.dark && !
|
|
56
|
+
if (userTheme.dark && !isEqual(stored.dark, userTheme.dark)) {
|
|
57
57
|
stored.dark = userTheme.dark;
|
|
58
58
|
updateStore(stored);
|
|
59
59
|
}
|
|
60
|
-
if (userTheme.light && !
|
|
60
|
+
if (userTheme.light && !isEqual(stored.light, userTheme.light)) {
|
|
61
61
|
stored.light = userTheme.light;
|
|
62
62
|
updateStore(stored);
|
|
63
63
|
}
|
package/dist/manager.js
CHANGED
|
@@ -6,7 +6,7 @@ import { IconButton } from 'storybook/internal/components';
|
|
|
6
6
|
import { SunIcon, MoonIcon } from '@storybook/icons';
|
|
7
7
|
import { STORY_CHANGED, SET_STORIES, DOCS_RENDERED } from 'storybook/internal/core-events';
|
|
8
8
|
import { global } from '@storybook/global';
|
|
9
|
-
import
|
|
9
|
+
import { isEqual } from 'lodash-es';
|
|
10
10
|
|
|
11
11
|
// src/preset/manager.tsx
|
|
12
12
|
|
|
@@ -69,11 +69,11 @@ var store = (userTheme = {}) => {
|
|
|
69
69
|
if (typeof storedItem === "string") {
|
|
70
70
|
const stored = JSON.parse(storedItem);
|
|
71
71
|
if (userTheme) {
|
|
72
|
-
if (userTheme.dark && !
|
|
72
|
+
if (userTheme.dark && !isEqual(stored.dark, userTheme.dark)) {
|
|
73
73
|
stored.dark = userTheme.dark;
|
|
74
74
|
updateStore(stored);
|
|
75
75
|
}
|
|
76
|
-
if (userTheme.light && !
|
|
76
|
+
if (userTheme.light && !isEqual(stored.light, userTheme.light)) {
|
|
77
77
|
stored.light = userTheme.light;
|
|
78
78
|
updateStore(stored);
|
|
79
79
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueless/storybook-dark-mode",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.3-beta.0",
|
|
4
4
|
"description": "Toggle between light and dark mode in Storybook",
|
|
5
5
|
"author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
|
|
6
6
|
"repository": {
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@storybook/global": "^5.0.0",
|
|
28
|
-
"
|
|
29
|
-
"memoizerific": "^1.11.3"
|
|
28
|
+
"lodash-es": "^4.17.21"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
31
|
"@eslint/js": "^9.33.0",
|
|
33
32
|
"@release-it/bumper": "^7.0.5",
|
|
34
33
|
"@release-it/conventional-changelog": "^10.0.1",
|
|
35
|
-
"@storybook/builder-vite": "^10.0.
|
|
34
|
+
"@storybook/builder-vite": "^10.0.4",
|
|
36
35
|
"@storybook/icons": "^1.4.0",
|
|
37
|
-
"@storybook/react": "^10.0.
|
|
38
|
-
"@storybook/react-vite": "^10.0.
|
|
36
|
+
"@storybook/react": "^10.0.4",
|
|
37
|
+
"@storybook/react-vite": "^10.0.4",
|
|
39
38
|
"@stylistic/eslint-plugin": "^5.2.3",
|
|
39
|
+
"@types/lodash-es": "^4.17.12",
|
|
40
40
|
"@types/node": "^24.3.0",
|
|
41
41
|
"@types/react": "^18.0.26",
|
|
42
42
|
"eslint": "^9.33.0",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"prettier": "^3.6.2",
|
|
49
49
|
"react": "^18.2.0",
|
|
50
50
|
"react-dom": "^18.2.0",
|
|
51
|
-
"release-it": "^19.0.
|
|
51
|
+
"release-it": "^19.0.6",
|
|
52
52
|
"rimraf": "^3.0.2",
|
|
53
|
-
"storybook": "^10.0.
|
|
53
|
+
"storybook": "^10.0.4",
|
|
54
54
|
"ts-node": "^10.9.2",
|
|
55
55
|
"tsup": "^8.0.0",
|
|
56
56
|
"typescript": "^5.9.2",
|
package/src/store.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { global } from "@storybook/global";
|
|
2
2
|
import { themes, ThemeVars } from "storybook/theming";
|
|
3
|
-
import
|
|
3
|
+
import { isEqual } from "lodash-es";
|
|
4
4
|
|
|
5
5
|
const { document, window } = global as { document: Document; window: Window };
|
|
6
6
|
|
|
@@ -92,12 +92,12 @@ export const store = (userTheme: Partial<DarkModeStore> = {}): DarkModeStore =>
|
|
|
92
92
|
const stored = JSON.parse(storedItem) as DarkModeStore;
|
|
93
93
|
|
|
94
94
|
if (userTheme) {
|
|
95
|
-
if (userTheme.dark && !
|
|
95
|
+
if (userTheme.dark && !isEqual(stored.dark, userTheme.dark)) {
|
|
96
96
|
stored.dark = userTheme.dark;
|
|
97
97
|
updateStore(stored);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
if (userTheme.light && !
|
|
100
|
+
if (userTheme.light && !isEqual(stored.light, userTheme.light)) {
|
|
101
101
|
stored.light = userTheme.light;
|
|
102
102
|
updateStore(stored);
|
|
103
103
|
}
|