@vueless/storybook 0.0.63 → 0.0.65

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.
@@ -11,6 +11,12 @@ export const storyDarkModeDecorator = () => {
11
11
 
12
12
  initializeThemeState(["light", "dark"], cachedColorMode);
13
13
 
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
+
14
20
  return (story, context) => {
15
21
  const theme = pluckThemeFromContext(context);
16
22
 
@@ -7,6 +7,51 @@
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
+ @apply bg-gray-50 hover:bg-gray-200;
24
+ }
25
+
26
+ .light ::-webkit-scrollbar-thumb {
27
+ @apply bg-gray-400 hover:bg-gray-500;
28
+ }
29
+
30
+ .light * {
31
+ scrollbar-color: rgba(var(--vl-color-gray-400)) rgba(var(--vl-color-gray-50)); /* thumb color track color */
32
+ }
33
+
34
+ .dark ::-webkit-scrollbar-track {
35
+ @apply bg-gray-950 hover:bg-gray-800;
36
+ }
37
+
38
+ .dark ::-webkit-scrollbar-thumb {
39
+ @apply bg-gray-600 hover:bg-gray-500;
40
+ }
41
+
42
+ .dark * {
43
+ scrollbar-width: thin;
44
+ scrollbar-color: rgba(var(--vl-color-gray-600)) rgba(var(--vl-color-gray-950)); /* thumb color track color */
45
+ }
46
+
47
+ html.dark {
48
+ @apply bg-gray-950;
49
+ }
50
+
51
+ html.light {
52
+ @apply bg-gray-50;
53
+ }
54
+
10
55
  body {
11
56
  font-family: Roboto, sans-serif;
12
57
  }
@@ -15,6 +60,7 @@ body {
15
60
  .light .sbdocs .sbdocs-content > h2,
16
61
  .light .sbdocs .sbdocs-content > h3,
17
62
  .light .sbdocs .sbdocs-content > .sb-anchor > h3,
63
+ .light .sbdocs .sbdocs-content > .sb-anchor > p,
18
64
  .light .sbdocs .sbdocs-content > p,
19
65
  .light .sbdocs .sbdocs-content > table th,
20
66
  .light .sbdocs .sbdocs-content > table td {
@@ -25,6 +71,7 @@ body {
25
71
  .dark .sbdocs .sbdocs-content > h2,
26
72
  .dark .sbdocs .sbdocs-content > h3,
27
73
  .dark .sbdocs .sbdocs-content > .sb-anchor > h3,
74
+ .dark .sbdocs .sbdocs-content > .sb-anchor > p,
28
75
  .dark .sbdocs .sbdocs-content > p,
29
76
  .dark .sbdocs .sbdocs-content > table th,
30
77
  .dark .sbdocs .sbdocs-content > table td {
@@ -112,8 +159,6 @@ body {
112
159
  @apply bg-gray-200;
113
160
  }
114
161
 
115
-
116
-
117
162
  .dark .sb-preparing-docs,
118
163
  .dark .sb-preparing-story {
119
164
  @apply bg-gray-950;
@@ -163,6 +208,14 @@ body {
163
208
  @apply mt-2;
164
209
  }
165
210
 
211
+ .dark .sb-anchor > p > a {
212
+ @apply text-green-400;
213
+ }
214
+
215
+ .light .sb-anchor > p > a {
216
+ @apply text-green-600;
217
+ }
218
+
166
219
  .sb-bar,
167
220
  .docs-story {
168
221
  @apply bg-white;
@@ -173,6 +226,10 @@ body {
173
226
  @apply bg-gray-900;
174
227
  }
175
228
 
229
+ .docs-story > div > div {
230
+ @apply mb-px;
231
+ }
232
+
176
233
  .sb-bar {
177
234
  @apply border-0;
178
235
  }
@@ -45,7 +45,7 @@ export const parameters = {
45
45
  darkMode: {
46
46
  light: themeLight,
47
47
  dark: themeDark,
48
- classTarget: "body",
48
+ classTarget: "html",
49
49
  stylePreview: true,
50
50
  },
51
51
  options: {
@@ -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
+ }
package/index.js CHANGED
@@ -11,7 +11,7 @@ const parsedArgs = parseArgs(args);
11
11
 
12
12
  const __dirname = path.dirname(new URL(import.meta.url).pathname);
13
13
  const source = path.join(__dirname, ".storybook");
14
- const target = path.join(cwd(), ".storybook-backup");
14
+ const target = path.join(cwd(), ".storybook");
15
15
 
16
16
  copyStorybookPreset(source, target);
17
17
 
@@ -24,7 +24,7 @@ if (parsedArgs.pnpm) {
24
24
  function copyStorybookPreset(source, target) {
25
25
  if (fs.existsSync(target)) {
26
26
  const timestamp = new Date().valueOf();
27
- const renamedTarget = `${target}-${timestamp}`;
27
+ const renamedTarget = `${target}-backup-${timestamp}`;
28
28
 
29
29
  fs.renameSync(target, renamedTarget);
30
30
  console.log(`Renamed existing ${path.basename(target)} to ${path.basename(renamedTarget)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueless/storybook",
3
- "version": "0.0.63",
3
+ "version": "0.0.65",
4
4
  "description": "Simplifies Storybook configuration for Vueless UI library.",
5
5
  "homepage": "https://vueless.com",
6
6
  "author": "Johnny Grid",