@vueless/storybook 0.0.65 → 0.0.66
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.
|
@@ -5,18 +5,24 @@ import { COLOR_MODE_KEY } from "vueless/constants.js";
|
|
|
5
5
|
const { initializeThemeState, pluckThemeFromContext } = DecoratorHelpers;
|
|
6
6
|
|
|
7
7
|
export const storyDarkModeDecorator = () => {
|
|
8
|
+
/* Set theme className to html tag before initialization (fix white blink issue). */
|
|
9
|
+
const sbAddonThemesConfig = localStorage.getItem("sb-addon-themes-3") || "{}";
|
|
10
|
+
const storybookTheme = JSON.parse(sbAddonThemesConfig).current || "light";
|
|
11
|
+
|
|
12
|
+
document.body.classList.add(storybookTheme); // this fixing first load
|
|
13
|
+
document.documentElement.classList.add(storybookTheme);
|
|
14
|
+
|
|
15
|
+
setTimeout(() => {
|
|
16
|
+
document.documentElement.classList.remove("light", "dark");
|
|
17
|
+
}, 4000);
|
|
18
|
+
|
|
19
|
+
/* Initialize theme state. */
|
|
8
20
|
const prefersColorSchemeDark = window.matchMedia("(prefers-color-scheme: dark)");
|
|
9
21
|
const preferScheme = prefersColorSchemeDark.matches ? "dark" : "light";
|
|
10
22
|
const cachedColorMode = localStorage.getItem(COLOR_MODE_KEY) || preferScheme;
|
|
11
23
|
|
|
12
24
|
initializeThemeState(["light", "dark"], cachedColorMode);
|
|
13
25
|
|
|
14
|
-
/* Set theme className to html tag before initialization. */
|
|
15
|
-
const sbAddonThemesConfig = localStorage.getItem("sb-addon-themes-3") || {};
|
|
16
|
-
const storybookTheme = JSON.parse(sbAddonThemesConfig).current || "light";
|
|
17
|
-
|
|
18
|
-
document.documentElement.classList.add(storybookTheme);
|
|
19
|
-
|
|
20
26
|
return (story, context) => {
|
|
21
27
|
const theme = pluckThemeFromContext(context);
|
|
22
28
|
|
package/.storybook/index.css
CHANGED
|
@@ -19,29 +19,36 @@
|
|
|
19
19
|
@apply rounded-sm transition;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
.light::-webkit-scrollbar-track,
|
|
22
23
|
.light ::-webkit-scrollbar-track {
|
|
23
24
|
@apply bg-gray-50 hover:bg-gray-200;
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
.light::-webkit-scrollbar-thumb,
|
|
26
28
|
.light ::-webkit-scrollbar-thumb {
|
|
27
29
|
@apply bg-gray-400 hover:bg-gray-500;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
.
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.dark ::-webkit-scrollbar-track {
|
|
32
|
+
.dark::-webkit-scrollbar-track,
|
|
33
|
+
.dark ::-webkit-scrollbar-track {
|
|
35
34
|
@apply bg-gray-950 hover:bg-gray-800;
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
.dark
|
|
37
|
+
.dark::-webkit-scrollbar-thumb,
|
|
38
|
+
.dark ::-webkit-scrollbar-thumb {
|
|
39
39
|
@apply bg-gray-600 hover:bg-gray-500;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
@supports (-moz-appearance: none) {
|
|
43
|
+
.light * {
|
|
44
|
+
scrollbar-width: thin;
|
|
45
|
+
scrollbar-color: #9ca3af #f9fafb; /* thumb color track color */
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.dark * {
|
|
49
|
+
scrollbar-width: thin;
|
|
50
|
+
scrollbar-color: #4b5563 #030712; /* thumb color track color */
|
|
51
|
+
}
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
html.dark {
|
|
@@ -25,7 +25,7 @@ Custom dark mode related vueless loader.
|
|
|
25
25
|
<style>
|
|
26
26
|
/* -------------------- Prevent showing users default storybook theme styles -------------------- */
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
html.dark {
|
|
29
29
|
background: #111827;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -33,6 +33,11 @@ Custom dark mode related vueless loader.
|
|
|
33
33
|
visibility: hidden;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
|
|
37
|
+
#sidebar-bottom-wrapper {
|
|
38
|
+
display: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
#sb-vueless-loader {
|
|
37
42
|
top: 0;
|
|
38
43
|
left: 0;
|
|
@@ -146,7 +151,7 @@ Custom dark mode related vueless loader.
|
|
|
146
151
|
setTimeout(() => {
|
|
147
152
|
document.getElementById("root").style.visibility = 'visible';
|
|
148
153
|
document.getElementById("sb-vueless-loader").style.display = 'none';
|
|
149
|
-
},
|
|
154
|
+
}, 1500);
|
|
150
155
|
};
|
|
151
156
|
})();
|
|
152
157
|
</script>
|
package/.storybook/preview.js
CHANGED