@vueless/storybook 0.0.39 → 0.0.41

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.
@@ -0,0 +1,11 @@
1
+ import { withThemeByDataAttribute } from "@storybook/addon-themes";
2
+
3
+ export const storyDarkModeDecorator = (darkClass, lightClass) =>
4
+ withThemeByDataAttribute({
5
+ attributeName: "class",
6
+ defaultTheme: "light",
7
+ themes: {
8
+ light: lightClass,
9
+ dark: darkClass,
10
+ },
11
+ });
@@ -54,7 +54,7 @@ export const vue3SourceDecorator = makeDecorator({
54
54
  }
55
55
  }
56
56
 
57
- return () => h("div", { style: `padding: 2rem 1.5rem 3rem 1.5rem;` }, [h(story)]);
57
+ return () => h("div", { class: "px-6 pt-8 pb-12" }, [h(story)]);
58
58
  },
59
59
  };
60
60
  },
@@ -0,0 +1,205 @@
1
+ @config "./tailwind.config.js";
2
+
3
+ @tailwind base;
4
+ @tailwind components;
5
+ @tailwind utilities;
6
+
7
+ /* -------------------- Storybook Preview UI -------------------- */
8
+ /* -------------------- General -------------------- */
9
+
10
+ body {
11
+ font-family: Roboto, sans-serif;
12
+ }
13
+
14
+ .dark h1, .dark h2, .dark h3 {
15
+ @apply text-gray-200;
16
+ }
17
+
18
+ /* -------------------- All docs block -------------------- */
19
+
20
+ .dark .sbdocs {
21
+ @apply bg-gray-950;
22
+ }
23
+
24
+ /* -------------------- Main story -------------------- */
25
+
26
+ .sb-bar,
27
+ .docs-story {
28
+ @apply bg-white;
29
+ }
30
+
31
+ .vl-dark .sb-bar,
32
+ .vl-dark .docs-story {
33
+ @apply !bg-gray-900;
34
+ }
35
+
36
+ .sb-bar {
37
+ @apply border-0;
38
+ }
39
+
40
+ .dark .sb-bar,
41
+ .dark .docs-story {
42
+ @apply bg-gray-100;
43
+ }
44
+
45
+ .dark .sb-bar {
46
+ @apply border-b border-gray-300;
47
+ box-shadow: none !important;
48
+ }
49
+
50
+ .vl-dark .sb-bar {
51
+ @apply border-b border-gray-800;
52
+ box-shadow: none !important;
53
+ }
54
+
55
+ .sbdocs.sbdocs-preview .prismjs {
56
+ @apply border-t border-t-gray-700 bg-gray-800;
57
+ }
58
+
59
+ .vl-dark .docblock-code-toggle {
60
+ @apply bg-gray-800 border-gray-800 text-gray-400 rounded-tl-none;
61
+ }
62
+
63
+ .sbdocs-preview {
64
+ box-shadow: none !important;
65
+ }
66
+
67
+ .dark .sbdocs.sbdocs-preview,
68
+ .vl-dark .sbdocs.sbdocs-preview {
69
+ @apply border-gray-800;
70
+ }
71
+
72
+ /* -------------------- Args table -------------------- */
73
+
74
+ .dark .docblock-argstable,
75
+ .dark .docblock-argstable-head th {
76
+ @apply !text-gray-200;
77
+ }
78
+
79
+ .docblock-argstable-body {
80
+ @apply rounded-lg !filter-none;
81
+ }
82
+
83
+ .docblock-argstable-body tr td {
84
+ @apply !rounded-none;
85
+ }
86
+
87
+ .docblock-argstable-body tr:not([title]) > td {
88
+ @apply !bg-white;
89
+ }
90
+
91
+ .dark .docblock-argstable-body tr > td {
92
+ @apply border-b border-solid !bg-gray-900 border-s-0 border-e-0 !border-t-gray-800;
93
+ border-block-end: none !important;
94
+ }
95
+
96
+ .dark .docblock-argstable-body tr > td:first-child,
97
+ .dark .docblock-argstable-body tr > td:last-child {
98
+ @apply !border-s-gray-800 !border-e-gray-800;
99
+ }
100
+
101
+ .dark .docblock-argstable-body {
102
+ @apply border border-b-gray-800;
103
+ }
104
+
105
+ .dark .docblock-argstable-body tr[title] > td {
106
+ @apply !bg-gray-800 !text-gray-400;
107
+ }
108
+
109
+ .dark .docblock-argstable-body tr[title] > td svg {
110
+ @apply !text-gray-400;
111
+ }
112
+
113
+ .dark .docblock-argstable-body tr > td > div + div > span,
114
+ .dark .docblock-argstable-body tr > td > div + div > div > span,
115
+ .dark .docblock-argstable-body tr > td:nth-child(3) > div > span[class],
116
+ .dark .docblock-argstable-body tr > td:nth-child(3) > span[class] {
117
+ @apply bg-gray-800 border-gray-700/50 text-gray-400;
118
+ }
119
+
120
+ .dark .docblock-argstable-body tr > td textarea,
121
+ .dark .docblock-argstable-body tr > td select,
122
+ .dark .docblock-argstable-body tr > td:nth-child(4) button {
123
+ @apply text-gray-200 bg-gray-800 border border-solid border-gray-700/50 hover:border-gray-600 focus:border-gray-500;
124
+ box-shadow: none !important;
125
+ }
126
+
127
+ .light .docblock-argstable-body tr > td textarea,
128
+ .light .docblock-argstable-body tr > td select,
129
+ .light .docblock-argstable-body tr > td:nth-child(4) button {
130
+ @apply border border-solid border-gray-300 hover:border-gray-400 focus:border-gray-500;
131
+ box-shadow: none !important;
132
+ }
133
+
134
+ .dark .docblock-argstable-body [type='checkbox'],
135
+ .dark .docblock-argstable-body [type='radio'] {
136
+ @apply !border !border-solid !border-gray-300;
137
+ box-shadow: none !important;
138
+ }
139
+
140
+ .dark .docblock-argstable-body [type='checkbox']:checked,
141
+ .dark .docblock-argstable-body [type='radio']:checked {
142
+ @apply bg-gray-700;
143
+ }
144
+
145
+ .docblock-argstable-body [type='checkbox']:checked,
146
+ .docblock-argstable-body [type='radio']:checked {
147
+ @apply !bg-gray-900;
148
+ }
149
+
150
+ .docblock-argstable [type='checkbox']:focus,
151
+ .docblock-argstable [type='radio']:focus {
152
+ @apply !ring-gray-300;
153
+ }
154
+
155
+ /* -------------------- Code block and user markdown -------------------- */
156
+
157
+ #storybook-docs h2 {
158
+ @apply mt-8 mb-6 pb-2 font-bold;
159
+ }
160
+
161
+ .dark h2 {
162
+ @apply border-b-gray-800;
163
+ }
164
+
165
+ .sbdocs-title + p code {
166
+ @apply bg-white;
167
+ }
168
+
169
+ .docblock-source {
170
+ @apply !bg-gray-800 border-gray-800 !rounded-lg;
171
+ box-shadow: none !important;
172
+ }
173
+
174
+ .dark .docblock-source {
175
+ @apply !bg-gray-900 !border-gray-800;
176
+ }
177
+
178
+ .dark .docblock-source button {
179
+ @apply bg-gray-800 border-gray-800 text-gray-400 rounded-tl-none;
180
+ }
181
+
182
+ .markdown code {
183
+ background-color: #f3f4f6 !important;
184
+ border-color: #d1d5db !important;
185
+ }
186
+
187
+ .markdown .sbdocs-a {
188
+ border-bottom: dashed 1px #4b5563;
189
+ color: #4b5563;
190
+ }
191
+
192
+ .markdown .sbdocs-a:hover {
193
+ border-bottom: none;
194
+ color: #4b5563;
195
+ }
196
+
197
+ /* -------------------- Storybook story preview -------------------- */
198
+
199
+ .vl-dark {
200
+ @apply min-h-full bg-gray-950;
201
+ }
202
+
203
+ .vl-light {
204
+ @apply min-h-full bg-white;
205
+ }
@@ -7,15 +7,19 @@ export default {
7
7
  "../src/**/*.@(mdx)",
8
8
  ],
9
9
  addons: [
10
- "storybook-dark-mode",
11
10
  "@storybook/addon-links",
12
- "@storybook/addon-themes",
13
11
  "@storybook/addon-essentials",
14
12
  "@storybook/addon-interactions",
13
+ "storybook-dark-mode",
14
+ // "@storybook/addon-themes", // TODO: uncomment when dark mode will be implemented to the components.
15
15
  ],
16
16
  framework: {
17
17
  name: "@storybook/vue3-vite",
18
- options: {},
18
+ options: {
19
+ builder: {
20
+ viteConfigPath: ".storybook/vite.config.js",
21
+ },
22
+ },
19
23
  },
20
24
  docs: {
21
25
  autodocs: true,
@@ -7,7 +7,60 @@ Overrides content of storybook layout HTML page <head> tag,
7
7
 
8
8
  <!-- Styles overriding -->
9
9
  <style>
10
- div[data-testid="tooltip"] a[id]:hover {
11
- background-color: rgb(17 24 39 / 5%) !important;
12
- }
10
+ /* -------------------- Storybook config tooltip -------------------- */
11
+
12
+ div[data-testid="tooltip"] {
13
+ border-radius: 8px;
14
+ overflow: hidden;
15
+ }
16
+
17
+ div[data-testid="tooltip"] a[id]:hover,
18
+ div[data-testid="tooltip"] button[id]:hover {
19
+ background-color: rgb(17 24 39 / 5%) !important;
20
+ }
21
+
22
+ .dark div[data-testid="tooltip"] a[id]:hover,
23
+ .dark div[data-testid="tooltip"] button[id]:hover {
24
+ background-color: rgb(255 255 255 / 5%) !important;
25
+ }
26
+
27
+ /* -------------------- Storybook sidebar -------------------- */
28
+
29
+ .sidebar-header img {
30
+ width: 150px;
31
+ }
32
+
33
+ .sidebar-header a:focus {
34
+ border: 1px solid transparent;
35
+ }
36
+
37
+ /* -------------------- Storybook args -------------------- */
38
+
39
+ .dark,
40
+ .dark #panel-tab-content div,
41
+ .dark .docblock-argstable-body > tr > td {
42
+ background: #030712 !important;
43
+ }
44
+
45
+ .light,
46
+ .light #panel-tab-content div,
47
+ .light .docblock-argstable-body > tr > td {
48
+ background: #f9fafb !important;
49
+ }
50
+
51
+ .dark .docblock-argstable-head > tr {
52
+ background: #1e293b !important;
53
+ }
54
+
55
+ .dark .docblock-argstable-body tr > td textarea,
56
+ .dark .docblock-argstable-body tr > td select,
57
+ .dark .docblock-argstable-body tr > td:last-child button:not([tabindex="-1"]) {
58
+ background: #111827;
59
+ border: solid 1px #1f2937;
60
+ box-shadow: none;
61
+ }
62
+
63
+ .light .docblock-argstable-body tr > td:last-child button:not([tabindex="-1"]) {
64
+ background: white;
65
+ }
13
66
  </style>
@@ -1,6 +1,7 @@
1
1
  import { addons } from "@storybook/manager-api";
2
- import vuelessTheme from "./themes/vueless.theme.js";
2
+ import themeLight from "./themes/themeLight.js";
3
3
 
4
4
  addons.setConfig({
5
- theme: vuelessTheme,
5
+ theme: themeLight,
6
+ panelPosition: "right",
6
7
  });
@@ -0,0 +1,6 @@
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };
@@ -8,69 +8,3 @@ affecting rendered component(s) below Canvas and Docs tabs.
8
8
  <link rel="preconnect" crossorigin="anonymous" href="https://fonts.googleapis.com">
9
9
  <link rel="preconnect" crossorigin="anonymous" href="https://fonts.gstatic.com">
10
10
  <link rel="stylesheet" crossorigin="anonymous" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap">
11
-
12
- <!-- Styles overriding -->
13
- <style>
14
- body {
15
- font-family: Roboto, sans-serif;
16
- }
17
-
18
- #storybook-docs h2 {
19
- margin-top: 32px !important;
20
- margin-bottom: 24px !important;
21
- padding-bottom: 8px !important;
22
- font-weight: bold !important;
23
- }
24
-
25
- .docblock-argstable-body {
26
- filter: none !important;
27
- border-radius: 0.5rem !important;
28
- }
29
-
30
- .docblock-argstable-body tr:not([title]) > td {
31
- background-color: white !important;
32
- }
33
-
34
- .docblock-argstable-body tr td {
35
- border-radius: 0 !important;
36
- }
37
-
38
- .sbdocs-preview {
39
- box-shadow: none !important;
40
- }
41
-
42
- .docblock-argstable [type='checkbox']:checked,
43
- .docblock-argstable [type='radio']:checked {
44
- background-color: rgb(17 24 39) !important;
45
- }
46
-
47
- .docblock-argstable [type='checkbox']:focus,
48
- .docblock-argstable [type='radio']:focus {
49
- @apply !ring-gray-300;
50
- }
51
-
52
- .sbdocs-title + p code {
53
- background: #fff;
54
- }
55
-
56
- .markdown {
57
- .docblock-source {
58
- margin: 0px 0 24px !important;
59
- }
60
-
61
- code {
62
- background-color: #f3f4f6 !important;
63
- border-color: #d1d5db !important;
64
- }
65
-
66
- .sbdocs-a {
67
- border-bottom: dashed 1px #4b5563;
68
- color: #4b5563;
69
- }
70
-
71
- .sbdocs-a:hover {
72
- border-bottom: none;
73
- color: #4b5563;
74
- }
75
- }
76
- </style>
@@ -1,19 +1,21 @@
1
1
  import { setup } from "@storybook/vue3";
2
- import { DARK_MODE_SELECTOR } from "vueless/constants.js";
3
- import { withThemeByClassName } from '@storybook/addon-themes';
4
2
 
5
- import { backgrounds, docs, layout } from "./configs/main.config.js";
3
+ import themeLight from "./themes/themeLight.js";
4
+ import themeDark from "./themes/themeDark.js";
5
+ import themeLightDocs from "./themes/themeLightDocs.js";
6
+ import { storyDarkModeDecorator } from "./decorators/storyDarkModeDecorator.js";
6
7
  import { vue3SourceDecorator } from "./decorators/vue3SourceDecorator.js";
8
+ import { DARK_MODE_SELECTOR, LIGHT_MODE_SELECTOR } from "vueless/constants.js";
7
9
 
8
- // Vue plugins
10
+ /* Tailwind styles */
11
+ import "./index.css";
12
+
13
+ /* Vue plugins */
9
14
  import { createVueless } from "vueless";
10
15
  import { createRouter, createWebHistory } from "vue-router";
11
16
 
12
- // Tailwind styles
13
- import "./index.pcss";
14
-
15
- // Create storybook app instance
16
- const storybookApp = (app) => {
17
+ /* Setup storybook */
18
+ setup((app) => {
17
19
  const vueless = createVueless();
18
20
  const router = createRouter({ history: createWebHistory(), routes: [] });
19
21
 
@@ -21,31 +23,35 @@ const storybookApp = (app) => {
21
23
  app.use(router);
22
24
  app.use(vueless);
23
25
  }
24
- };
26
+ });
27
+
28
+ /* Set storybook decorators */
29
+ export const decorators = [
30
+ vue3SourceDecorator,
31
+ storyDarkModeDecorator(DARK_MODE_SELECTOR, LIGHT_MODE_SELECTOR),
32
+ ];
33
+
34
+ /* Set storybook parameters */
35
+ export const parameters = {
36
+ layout: "fullscreen",
37
+ backgrounds: { disable: true },
38
+ docs: {
39
+ theme: themeLightDocs,
40
+ source: { language: "html" },
41
+ },
42
+ darkMode: {
43
+ current: "light",
44
+ light: themeLight,
45
+ dark: themeDark,
46
+ classTarget: "body",
47
+ stylePreview: true,
48
+ },
49
+ options: {
50
+ storySort: (a, b) => {
51
+ const idA = a.id.split("--")[0];
52
+ const idB = b.id.split("--")[0];
25
53
 
26
- // Setup storybook
27
- setup(storybookApp);
28
-
29
- // Set storybook config
30
- export default {
31
- decorators: [
32
- vue3SourceDecorator,
33
- withThemeByClassName({
34
- themes: { light: "", dark: DARK_MODE_SELECTOR },
35
- defaultTheme: "dark",
36
- }),
37
- ],
38
- parameters: {
39
- layout,
40
- docs,
41
- backgrounds,
42
- options: {
43
- storySort: (a, b) => {
44
- const idA = a.id.split("--")[0];
45
- const idB = b.id.split("--")[0];
46
-
47
- return idA.localeCompare(idB, undefined, { numeric: true });
48
- },
54
+ return idA.localeCompare(idB, undefined, { numeric: true });
49
55
  },
50
56
  },
51
57
  };
@@ -0,0 +1,12 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ import { vuelessContent, vuelessContentVue, vuelessPreset } from "vueless/preset.tailwind.js";
3
+
4
+ export default {
5
+ content: [...vuelessContent, ...vuelessContentVue, "./.storybook/**/*.{js,ts,jsx,tsx,html}"],
6
+ presets: [vuelessPreset],
7
+ theme: {
8
+ fontFamily: {
9
+ roboto: ["Roboto", "sans-serif"],
10
+ },
11
+ },
12
+ };
@@ -0,0 +1,46 @@
1
+ import { create } from "@storybook/theming/create";
2
+ import colors from "tailwindcss/colors.js";
3
+
4
+ export default create({
5
+ base: "dark",
6
+ // Typography
7
+ fontBase: '"Roboto", sans-serif',
8
+ fontCode: "monospace",
9
+
10
+ brandTitle: "Vueless UI",
11
+ brandUrl: "https://vueless.com",
12
+ brandImage:
13
+ "https://raw.githubusercontent.com/vuelessjs/vueless-storybook/main/public/images/vueless-logo-dark.svg",
14
+ brandTarget: "_blank",
15
+
16
+ // Main colors
17
+ colorPrimary: colors.gray["200"],
18
+ colorSecondary: colors.gray["700"],
19
+
20
+ // UI
21
+ appBg: colors.gray["900"],
22
+ appPreviewBg: colors.gray["900"],
23
+ appBorderColor: colors.gray["900"],
24
+ appBorderRadius: 0,
25
+
26
+ // Text colors
27
+ textColor: colors.gray["300"],
28
+ textInverseColor: colors.gray["800"],
29
+
30
+ // Toolbar default and active colors
31
+ barTextColor: colors.gray["500"],
32
+ barHoverColor: colors.gray["400"],
33
+ barSelectedColor: colors.gray["300"],
34
+ barBg: colors.gray["950"],
35
+
36
+ // Form colors
37
+ inputBg: colors.gray["950"],
38
+ inputBorder: colors.gray["600"],
39
+ inputTextColor: colors.gray["100"],
40
+ inputBorderRadius: 4,
41
+
42
+ buttonBg: colors.gray["800"],
43
+ buttonBorder: colors.gray["800"],
44
+ booleanBg: colors.gray["900"],
45
+ booleanSelectedBg: colors.gray["800"],
46
+ });
@@ -10,7 +10,7 @@ export default create({
10
10
  brandTitle: "Vueless UI",
11
11
  brandUrl: "https://vueless.com",
12
12
  brandImage:
13
- "https://raw.githubusercontent.com/vuelessjs/vueless-storybook/main/public/images/logo.png",
13
+ "https://raw.githubusercontent.com/vuelessjs/vueless-storybook/main/public/images/vueless-logo-light.svg",
14
14
  brandTarget: "_blank",
15
15
 
16
16
  // Main colors
@@ -25,7 +25,7 @@ export default create({
25
25
 
26
26
  // Text colors
27
27
  textColor: colors.gray["900"],
28
- textInverseColor: colors.gray["50"],
28
+ textInverseColor: colors.gray["900"],
29
29
 
30
30
  // Toolbar default and active colors
31
31
  barTextColor: colors.gray["500"],
@@ -40,7 +40,7 @@ export default create({
40
40
  inputBorderRadius: 4,
41
41
 
42
42
  buttonBg: colors.gray["100"],
43
- buttonBorder: colors.gray["100"],
44
- booleanBg: colors.white,
45
- booleanSelectedBg: colors.gray["100"],
43
+ buttonBorder: colors.gray["200"],
44
+ booleanBg: colors.gray["50"],
45
+ booleanSelectedBg: colors.gray["200"],
46
46
  });
@@ -0,0 +1,19 @@
1
+ import { defineConfig } from "vite";
2
+
3
+ // Plugins
4
+ import Vue from "@vitejs/plugin-vue";
5
+ import { Vueless } from "@vueless/plugin-vite";
6
+
7
+ export default defineConfig({
8
+ plugins: [Vue(), Vueless({ mode: "storybook", env: "vueless", debug: false })],
9
+ optimizeDeps: {
10
+ include: [
11
+ "cva",
12
+ "tailwind-merge",
13
+ "prettier2",
14
+ "prettier2/parser-html",
15
+ "@storybook/blocks",
16
+ "@storybook/theming/create",
17
+ ],
18
+ },
19
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueless/storybook",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "description": "Simplifies Storybook configuration for Vueless UI library.",
5
5
  "homepage": "https://vueless.com",
6
6
  "author": "Johnny Grid",
@@ -48,7 +48,8 @@
48
48
  "prettier": "^3.2.5",
49
49
  "prettier-eslint": "^16.3.0",
50
50
  "release-it": "^17.2.1",
51
- "vue-router": "^4.3.2"
51
+ "vue-router": "^4.3.2",
52
+ "vueless": "^0.0.439"
52
53
  },
53
54
  "resolutions": {
54
55
  "jackspeak": "2.3.6"
@@ -1,20 +0,0 @@
1
- import vuelessDocsTheme from "../themes/vueless.docs.theme.js";
2
- import colors from "tailwindcss/colors.js";
3
-
4
- export const docs = {
5
- theme: vuelessDocsTheme,
6
- source: {
7
- language: "html",
8
- },
9
- };
10
-
11
- export const backgrounds = {
12
- default: "white",
13
- values: [
14
- { name: "white", value: colors.white },
15
- { name: "light", value: colors.gray[50] },
16
- { name: "dark", value: colors.gray[900] },
17
- ],
18
- };
19
-
20
- export const layout = "fullscreen";
@@ -1,3 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;