@vueless/storybook 0.0.65 → 0.0.67
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 {
|
|
@@ -328,7 +335,12 @@ body {
|
|
|
328
335
|
.dark .docblock-argstable-body tr > td:nth-child(2) > div > div > span[class],
|
|
329
336
|
.dark .docblock-argstable-body tr > td:nth-child(3) > div > span[class],
|
|
330
337
|
.dark .docblock-argstable-body tr > td:nth-child(3) > span[class] {
|
|
331
|
-
@apply
|
|
338
|
+
@apply bg-gray-800 border-gray-700/50 text-gray-400;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.dark .sb-story code,
|
|
342
|
+
.light .sb-story code {
|
|
343
|
+
@apply !bg-inherit !text-inherit;
|
|
332
344
|
}
|
|
333
345
|
|
|
334
346
|
.dark .docblock-argstable-body tr > td > div + div > span:not([class]) {
|
|
@@ -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
|
|
|
@@ -108,6 +108,32 @@ Custom dark mode related vueless loader.
|
|
|
108
108
|
border: 1px solid transparent;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
.sidebar-item {
|
|
112
|
+
text-transform: capitalize;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.light .sidebar-item svg[width="12"] {
|
|
116
|
+
color: #10b981;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.light .sidebar-item[data-nodetype="document"] svg[width="12"],
|
|
120
|
+
.light .sidebar-item[data-nodetype="story"] svg[width="12"] {
|
|
121
|
+
color: #9ca3af;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.dark .sidebar-item[data-nodetype="document"] svg[width="12"],
|
|
125
|
+
.dark .sidebar-item[data-nodetype="story"] svg[width="12"] {
|
|
126
|
+
color: #4b5563;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.dark .sidebar-item svg[width="12"] {
|
|
130
|
+
color: #059669;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
#sidebar-bottom-wrapper {
|
|
134
|
+
display: none;
|
|
135
|
+
}
|
|
136
|
+
|
|
111
137
|
/* -------------------- Storybook args -------------------- */
|
|
112
138
|
|
|
113
139
|
.dark,
|
|
@@ -146,7 +172,7 @@ Custom dark mode related vueless loader.
|
|
|
146
172
|
setTimeout(() => {
|
|
147
173
|
document.getElementById("root").style.visibility = 'visible';
|
|
148
174
|
document.getElementById("sb-vueless-loader").style.display = 'none';
|
|
149
|
-
},
|
|
175
|
+
}, 1500);
|
|
150
176
|
};
|
|
151
177
|
})();
|
|
152
178
|
</script>
|
package/.storybook/preview.js
CHANGED