@vueless/storybook 0.0.64 → 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,6 +5,18 @@ 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;
|
package/.storybook/index.css
CHANGED
|
@@ -7,6 +7,58 @@
|
|
|
7
7
|
/* -------------------- Storybook Preview UI -------------------- */
|
|
8
8
|
/* -------------------- General -------------------- */
|
|
9
9
|
|
|
10
|
+
::-webkit-scrollbar {
|
|
11
|
+
@apply w-3 h-3;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
::-webkit-scrollbar-track {
|
|
15
|
+
@apply transition;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
::-webkit-scrollbar-thumb {
|
|
19
|
+
@apply rounded-sm transition;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.light::-webkit-scrollbar-track,
|
|
23
|
+
.light ::-webkit-scrollbar-track {
|
|
24
|
+
@apply bg-gray-50 hover:bg-gray-200;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.light::-webkit-scrollbar-thumb,
|
|
28
|
+
.light ::-webkit-scrollbar-thumb {
|
|
29
|
+
@apply bg-gray-400 hover:bg-gray-500;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.dark::-webkit-scrollbar-track,
|
|
33
|
+
.dark ::-webkit-scrollbar-track {
|
|
34
|
+
@apply bg-gray-950 hover:bg-gray-800;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.dark::-webkit-scrollbar-thumb,
|
|
38
|
+
.dark ::-webkit-scrollbar-thumb {
|
|
39
|
+
@apply bg-gray-600 hover:bg-gray-500;
|
|
40
|
+
}
|
|
41
|
+
|
|
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
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
html.dark {
|
|
55
|
+
@apply bg-gray-950;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
html.light {
|
|
59
|
+
@apply bg-gray-50;
|
|
60
|
+
}
|
|
61
|
+
|
|
10
62
|
body {
|
|
11
63
|
font-family: Roboto, sans-serif;
|
|
12
64
|
}
|
|
@@ -15,6 +67,7 @@ body {
|
|
|
15
67
|
.light .sbdocs .sbdocs-content > h2,
|
|
16
68
|
.light .sbdocs .sbdocs-content > h3,
|
|
17
69
|
.light .sbdocs .sbdocs-content > .sb-anchor > h3,
|
|
70
|
+
.light .sbdocs .sbdocs-content > .sb-anchor > p,
|
|
18
71
|
.light .sbdocs .sbdocs-content > p,
|
|
19
72
|
.light .sbdocs .sbdocs-content > table th,
|
|
20
73
|
.light .sbdocs .sbdocs-content > table td {
|
|
@@ -25,6 +78,7 @@ body {
|
|
|
25
78
|
.dark .sbdocs .sbdocs-content > h2,
|
|
26
79
|
.dark .sbdocs .sbdocs-content > h3,
|
|
27
80
|
.dark .sbdocs .sbdocs-content > .sb-anchor > h3,
|
|
81
|
+
.dark .sbdocs .sbdocs-content > .sb-anchor > p,
|
|
28
82
|
.dark .sbdocs .sbdocs-content > p,
|
|
29
83
|
.dark .sbdocs .sbdocs-content > table th,
|
|
30
84
|
.dark .sbdocs .sbdocs-content > table td {
|
|
@@ -112,8 +166,6 @@ body {
|
|
|
112
166
|
@apply bg-gray-200;
|
|
113
167
|
}
|
|
114
168
|
|
|
115
|
-
|
|
116
|
-
|
|
117
169
|
.dark .sb-preparing-docs,
|
|
118
170
|
.dark .sb-preparing-story {
|
|
119
171
|
@apply bg-gray-950;
|
|
@@ -163,6 +215,14 @@ body {
|
|
|
163
215
|
@apply mt-2;
|
|
164
216
|
}
|
|
165
217
|
|
|
218
|
+
.dark .sb-anchor > p > a {
|
|
219
|
+
@apply text-green-400;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.light .sb-anchor > p > a {
|
|
223
|
+
@apply text-green-600;
|
|
224
|
+
}
|
|
225
|
+
|
|
166
226
|
.sb-bar,
|
|
167
227
|
.docs-story {
|
|
168
228
|
@apply bg-white;
|
|
@@ -173,6 +233,10 @@ body {
|
|
|
173
233
|
@apply bg-gray-900;
|
|
174
234
|
}
|
|
175
235
|
|
|
236
|
+
.docs-story > div > div {
|
|
237
|
+
@apply mb-px;
|
|
238
|
+
}
|
|
239
|
+
|
|
176
240
|
.sb-bar {
|
|
177
241
|
@apply border-0;
|
|
178
242
|
}
|
|
@@ -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
|
@@ -57,3 +57,15 @@ export const parameters = {
|
|
|
57
57
|
},
|
|
58
58
|
},
|
|
59
59
|
};
|
|
60
|
+
|
|
61
|
+
/* Reload the page on error "Failed to fetch dynamically imported module..." */
|
|
62
|
+
window.addEventListener("error", (ev) => onFailedToFetchModule(ev.message));
|
|
63
|
+
window.addEventListener("unhandledrejection", (ev) => onFailedToFetchModule(ev?.reason?.message));
|
|
64
|
+
|
|
65
|
+
function onFailedToFetchModule(message) {
|
|
66
|
+
const isProd = import.meta.env.MODE === "production";
|
|
67
|
+
|
|
68
|
+
if (isProd && message?.includes("Failed to fetch dynamically imported module")) {
|
|
69
|
+
window.location.reload();
|
|
70
|
+
}
|
|
71
|
+
}
|