@vueless/storybook 1.2.10-beta.5 → 1.2.10-beta.7

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.
@@ -1,9 +1,10 @@
1
1
  import { addons } from "storybook/manager-api";
2
+ import { getThemeDark, getThemeLight } from "@vueless/storybook";
2
3
 
3
4
  /* Theme styles */
4
- import "./themes/manager.css";
5
- import { themeDark } from "./themes/themeDark.js";
6
- import { themeLight } from "./themes/themeLight.js";
5
+ import "./theme/theme.css";
6
+ import "@vueless/storybook/manager.css";
7
+ import { theme } from "./theme/theme.js";
7
8
 
8
9
  const DARK_MODE_KEY = "dark";
9
10
  const LIGHT_MODE_KEY = "light";
@@ -24,7 +25,7 @@ prefersColorSchemeDark.addEventListener("change", (event) => {
24
25
 
25
26
  function setSystemTheme(colorMode) {
26
27
  addons.setConfig({
27
- theme: colorMode === DARK_MODE_KEY ? themeDark : themeLight,
28
+ theme: colorMode === DARK_MODE_KEY ? getThemeDark(theme) : getThemeLight(theme),
28
29
  panelPosition: "right",
29
30
  });
30
31
  }
@@ -1,12 +1,17 @@
1
- import { storyDarkModeDecorator, vue3SourceDecorator } from "@vueless/storybook";
1
+ import {
2
+ getThemeDark,
3
+ getThemeLight,
4
+ getThemeLightPreview,
5
+ vue3SourceDecorator,
6
+ storyDarkModeDecorator,
7
+ } from "@vueless/storybook";
2
8
  import { getRandomId } from "vueless";
3
9
  import { setup } from "@storybook/vue3-vite";
4
10
 
5
11
  /* Theme styles */
6
- import "./themes/preview.css";
7
- import { themeDark } from "./themes/themeDark.js";
8
- import { themeLight } from "./themes/themeLight.js";
9
- import { themeLightPreview } from "./themes/themeLightPreview.js";
12
+ import "./theme/theme.css";
13
+ import "@vueless/storybook/preview.css";
14
+ import { theme } from "./theme/theme.js";
10
15
 
11
16
  /* Vue plugins */
12
17
  import { createVueless } from "vueless";
@@ -37,12 +42,12 @@ export default {
37
42
  layout: "fullscreen",
38
43
  backgrounds: { disable: true },
39
44
  docs: {
40
- theme: themeLightPreview,
45
+ theme: getThemeLightPreview(theme),
41
46
  source: { language: "html" },
42
47
  },
43
48
  darkMode: {
44
- light: themeLight,
45
- dark: themeDark,
49
+ light: getThemeLight(theme),
50
+ dark: getThemeDark(theme),
46
51
  classTarget: "body",
47
52
  stylePreview: true,
48
53
  },
@@ -0,0 +1,37 @@
1
+ /* -------------------- Color Palettes -------------------- */
2
+
3
+ :root {
4
+ /* Neutral (Gray) Colors */
5
+ --neutral-50: #f9fafb;
6
+ --neutral-100: #f3f4f6;
7
+ --neutral-200: #e5e7eb;
8
+ --neutral-300: #d1d5db;
9
+ --neutral-400: #9ca3af;
10
+ --neutral-500: #6b7280;
11
+ --neutral-600: #4b5563;
12
+ --neutral-700: #374151;
13
+ --neutral-800: #1f2937;
14
+ --neutral-900: #111827;
15
+ --neutral-950: #030712;
16
+
17
+ /* Primary (Green) Colors */
18
+ --primary-50: #f0fdf4;
19
+ --primary-100: #dcfce7;
20
+ --primary-200: #bbf7d0;
21
+ --primary-300: #86efac;
22
+ --primary-400: #4ade80;
23
+ --primary-500: #22c55e;
24
+ --primary-600: #16a34a;
25
+ --primary-700: #15803d;
26
+ --primary-800: #166534;
27
+ --primary-900: #14532d;
28
+ --primary-950: #052e16;
29
+
30
+ /* White */
31
+ --white: #ffffff;
32
+
33
+ /* Border Radius */
34
+ --rounded-sm: 0.25rem;
35
+ --rounded-md: 0.375rem;
36
+ --rounded-lg: 0.5rem;
37
+ }
@@ -0,0 +1,30 @@
1
+ export const theme = {
2
+ fontBase: '"Roboto", sans-serif',
3
+ fontCode: "monospace",
4
+ brandTitle: "Vueless UI",
5
+ brandUrl: "https://vueless.com",
6
+ brandTarget: "_blank",
7
+ brandImageLight: "./images/logo-light.svg",
8
+ brandImageDark: "./images/logo-dark.svg",
9
+ rounded: {
10
+ sm: 4,
11
+ md: 8,
12
+ lg: 12,
13
+ },
14
+ colors: {
15
+ white: "#ffffff",
16
+ gray: {
17
+ 50: "#f9fafb",
18
+ 100: "#f3f4f6",
19
+ 200: "#e5e7eb",
20
+ 300: "#d1d5db",
21
+ 400: "#9ca3af",
22
+ 500: "#6b7280",
23
+ 600: "#4b5563",
24
+ 700: "#374151",
25
+ 800: "#1f2937",
26
+ 900: "#111827",
27
+ 950: "#030712",
28
+ },
29
+ },
30
+ };
@@ -14,7 +14,7 @@ export default defineConfig({
14
14
  "prettier2",
15
15
  "prettier2/parser-html",
16
16
  "@storybook/addon-docs/blocks",
17
- "storybook/theming/create",
17
+ "storybook/theming",
18
18
  "storybook/internal/docs-tools",
19
19
  "@storybook/addon-themes",
20
20
  "@storybook/vue3-vite",
@@ -1,9 +1,10 @@
1
1
  import { addons } from "storybook/manager-api";
2
+ import { getThemeDark, getThemeLight } from "@vueless/storybook";
2
3
 
3
4
  /* Theme styles */
4
- import "./themes/manager.css";
5
- import { themeDark } from "./themes/themeDark";
6
- import { themeLight } from "./themes/themeLight";
5
+ import "./theme/theme.css";
6
+ import "@vueless/storybook/manager.css";
7
+ import { theme } from "./theme/theme";
7
8
 
8
9
  const DARK_MODE_KEY = "dark";
9
10
  const LIGHT_MODE_KEY = "light";
@@ -24,7 +25,7 @@ prefersColorSchemeDark.addEventListener("change", (event) => {
24
25
 
25
26
  function setSystemTheme(colorMode: string) {
26
27
  addons.setConfig({
27
- theme: colorMode === DARK_MODE_KEY ? themeDark : themeLight,
28
+ theme: colorMode === DARK_MODE_KEY ? getThemeDark(theme) : getThemeLight(theme),
28
29
  panelPosition: "right",
29
30
  });
30
31
  }
@@ -1,14 +1,19 @@
1
- import { storyDarkModeDecorator, vue3SourceDecorator } from "@vueless/storybook";
1
+ import {
2
+ getThemeDark,
3
+ getThemeLight,
4
+ getThemeLightPreview,
5
+ vue3SourceDecorator,
6
+ storyDarkModeDecorator,
7
+ } from "@vueless/storybook";
2
8
  import { getRandomId } from "vueless";
3
9
  import { setup } from "@storybook/vue3-vite";
4
10
 
5
11
  import type { Preview } from "@storybook/vue3-vite";
6
12
 
7
13
  /* Theme styles */
8
- import "./themes/preview.css";
9
- import { themeDark } from "./themes/themeDark";
10
- import { themeLight } from "./themes/themeLight";
11
- import { themeLightPreview } from "./themes/themeLightPreview";
14
+ import "./theme/theme.css";
15
+ import "@vueless/storybook/preview.css";
16
+ import { theme } from "./theme/theme";
12
17
 
13
18
  /* Vue plugins */
14
19
  import { createVueless } from "vueless";
@@ -39,12 +44,12 @@ export default {
39
44
  layout: "fullscreen",
40
45
  backgrounds: { disable: true },
41
46
  docs: {
42
- theme: themeLightPreview,
47
+ theme: getThemeLightPreview(theme),
43
48
  source: { language: "html" },
44
49
  },
45
50
  darkMode: {
46
- light: themeLight,
47
- dark: themeDark,
51
+ light: getThemeLight(theme),
52
+ dark: getThemeDark(theme),
48
53
  classTarget: "body",
49
54
  stylePreview: true,
50
55
  },
@@ -0,0 +1,38 @@
1
+ /* -------------------- Color Palettes -------------------- */
2
+
3
+ :root {
4
+ /* Neutral (Gray) Colors */
5
+ --neutral-50: #f9fafb;
6
+ --neutral-100: #f3f4f6;
7
+ --neutral-200: #e5e7eb;
8
+ --neutral-300: #d1d5db;
9
+ --neutral-400: #9ca3af;
10
+ --neutral-500: #6b7280;
11
+ --neutral-600: #4b5563;
12
+ --neutral-700: #374151;
13
+ --neutral-800: #1f2937;
14
+ --neutral-900: #111827;
15
+ --neutral-950: #030712;
16
+
17
+ /* Primary (Green) Colors */
18
+ --primary-50: #f0fdf4;
19
+ --primary-100: #dcfce7;
20
+ --primary-200: #bbf7d0;
21
+ --primary-300: #86efac;
22
+ --primary-400: #4ade80;
23
+ --primary-500: #22c55e;
24
+ --primary-600: #16a34a;
25
+ --primary-700: #15803d;
26
+ --primary-800: #166534;
27
+ --primary-900: #14532d;
28
+ --primary-950: #052e16;
29
+
30
+ /* White */
31
+ --white: #ffffff;
32
+
33
+ /* Border Radius */
34
+ --rounded-sm: 0.25rem;
35
+ --rounded-md: 0.375rem;
36
+ --rounded-lg: 0.5rem;
37
+ }
38
+
@@ -0,0 +1,31 @@
1
+ export const theme = {
2
+ fontBase: '"Roboto", sans-serif',
3
+ fontCode: "monospace",
4
+ brandTitle: "Vueless UI",
5
+ brandUrl: "https://vueless.com",
6
+ brandTarget: "_blank",
7
+ brandImageLight: "./images/logo-light.svg",
8
+ brandImageDark: "./images/logo-dark.svg",
9
+ rounded: {
10
+ sm: 4,
11
+ md: 8,
12
+ lg: 12,
13
+ },
14
+ colors: {
15
+ white: "#ffffff",
16
+ gray: {
17
+ 50: "#f9fafb",
18
+ 100: "#f3f4f6",
19
+ 200: "#e5e7eb",
20
+ 300: "#d1d5db",
21
+ 400: "#9ca3af",
22
+ 500: "#6b7280",
23
+ 600: "#4b5563",
24
+ 700: "#374151",
25
+ 800: "#1f2937",
26
+ 900: "#111827",
27
+ 950: "#030712",
28
+ },
29
+ },
30
+ };
31
+
@@ -14,7 +14,7 @@ export default defineConfig({
14
14
  "prettier2",
15
15
  "prettier2/parser-html",
16
16
  "@storybook/addon-docs/blocks",
17
- "storybook/theming/create",
17
+ "storybook/theming",
18
18
  "storybook/internal/docs-tools",
19
19
  "@storybook/addon-themes",
20
20
  "@storybook/vue3-vite",
@@ -25,14 +25,15 @@ export const storyDarkModeDecorator = makeDecorator({
25
25
  // this fixing first load
26
26
  document.body.classList.add(storybookColorMode);
27
27
 
28
+ // TODO: Temporary disables
28
29
  // this fixing white blink issue
29
- if (window.location.toString().includes("viewMode=docs")) {
30
- document.documentElement.classList.add(storybookColorMode);
31
-
32
- setTimeout(() => {
33
- document.documentElement.classList.remove("light", "dark");
34
- }, 4000);
35
- }
30
+ // if (window.location.toString().includes("viewMode=docs")) {
31
+ // document.documentElement.classList.add(storybookColorMode);
32
+ //
33
+ // setTimeout(() => {
34
+ // document.documentElement.classList.remove("light", "dark");
35
+ // }, 4000);
36
+ // }
36
37
 
37
38
  DecoratorHelpers.initializeThemeState(["light", "dark"], storybookColorMode || systemColorMode);
38
39
 
package/index.browser.js CHANGED
@@ -1,2 +1,6 @@
1
- export { storyDarkModeDecorator } from "./decorators/storyDarkModeDecorator.js";
1
+ export { getThemeDark } from "./theme/getThemeDark.js";
2
+ export { getThemeLight } from "./theme/getThemeLight.js";
3
+ export { getThemeLightPreview } from "./theme/getThemeLightPreview.js";
4
+
2
5
  export { vue3SourceDecorator } from "./decorators/vue3SourceDecorator.js";
6
+ export { storyDarkModeDecorator } from "./decorators/storyDarkModeDecorator.js";
package/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  export declare function defineConfigWithVueless(options?: any): () => any;
2
2
  export declare function getVuelessStoriesGlob(vuelessEnv?: string): Promise<string[]>;
3
3
 
4
+ export { getThemeDark } from "./theme/getThemeDark.js";
5
+ export { getThemeLight } from "./theme/getThemeLight.js";
6
+ export { getThemeLightPreview } from "./theme/getThemeLightPreview.js";
7
+
8
+ export { vue3SourceDecorator } from "./decorators/vue3SourceDecorator.js";
4
9
  export { storyDarkModeDecorator } from "./decorators/storyDarkModeDecorator.js";
5
- export { vue3SourceDecorator } from "./decorators/vue3SourceDecorator.js";
package/index.js CHANGED
@@ -1,4 +1,10 @@
1
1
  export { buildWebTypes } from "./webTypes/index.js";
2
+ export { storyDarkModeDecorator } from "./decorators/storyDarkModeDecorator.js";
3
+ export { vue3SourceDecorator } from "./decorators/vue3SourceDecorator.js";
4
+
5
+ export { getThemeDark } from "./theme/getThemeDark.js";
6
+ export { getThemeLight } from "./theme/getThemeLight.js";
7
+ export { getThemeLightPreview } from "./theme/getThemeLightPreview.js";
2
8
 
3
9
  import { getVuelessConfig } from "vueless/utils/node/vuelessConfig.js";
4
10
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueless/storybook",
3
- "version": "1.2.10-beta.5",
3
+ "version": "1.2.10-beta.7",
4
4
  "description": "Simplifies Storybook configuration for Vueless UI library.",
5
5
  "author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
6
6
  "homepage": "https://vueless.com",
@@ -27,7 +27,7 @@
27
27
  "@storybook/addon-links": "^10.0.2",
28
28
  "@storybook/addon-themes": "^10.0.2",
29
29
  "@storybook/vue3-vite": "^10.0.2",
30
- "@vueless/storybook-dark-mode": "^10.0.1-beta.0",
30
+ "@vueless/storybook-dark-mode": "^10.0.1",
31
31
  "chokidar": "^4.0.3",
32
32
  "esbuild": "^0.25.9",
33
33
  "globby": "^14.1.0",
@@ -56,7 +56,7 @@
56
56
  "vue": "latest",
57
57
  "vue-router": "latest",
58
58
  "vue-tsc": "^3.0.6",
59
- "vueless": "^1.2.14"
59
+ "vueless": "^1.3.1"
60
60
  },
61
61
  "type": "module",
62
62
  "main": "index.js",
@@ -66,7 +66,9 @@
66
66
  "node": "./index.js",
67
67
  "types": "./index.d.ts",
68
68
  "browser": "./index.browser.js"
69
- }
69
+ },
70
+ "./manager.css": "./theme/manager.css",
71
+ "./preview.css": "./theme/preview.css"
70
72
  },
71
73
  "overrides": {
72
74
  "vue-docgen-api": {
@@ -0,0 +1,47 @@
1
+ import { create } from "storybook/theming";
2
+
3
+ export function getThemeDark(theme) {
4
+ return create({
5
+ base: "dark",
6
+
7
+ /* Fonts */
8
+ fontBase: theme.fontBase,
9
+ fontCode: theme.fontCode,
10
+
11
+ /* Brand block */
12
+ brandTitle: theme.brandTitle,
13
+ brandUrl: theme.brandUrl,
14
+ brandImage: theme.brandImageDark,
15
+ brandTarget: theme.brandTarget,
16
+
17
+ /* Main colors */
18
+ colorPrimary: theme.colors.gray[200],
19
+ colorSecondary: theme.colors.gray[700],
20
+
21
+ /* UI */
22
+ appBg: theme.colors.gray[900],
23
+ appPreviewBg: theme.colors.gray[900],
24
+ appBorderColor: theme.colors.gray[900],
25
+ appBorderRadius: 0,
26
+
27
+ /* Text colors */
28
+ textColor: theme.colors.gray[300],
29
+ textInverseColor: theme.colors.gray[800],
30
+
31
+ /* Toolbar default and active colors */
32
+ barTextColor: theme.colors.gray[500],
33
+ barHoverColor: theme.colors.gray[400],
34
+ barSelectedColor: theme.colors.gray[300],
35
+ barBg: theme.colors.gray[950],
36
+
37
+ /* Form colors */
38
+ inputBg: theme.colors.gray[950],
39
+ inputBorder: theme.colors.gray[600],
40
+ inputTextColor: theme.colors.gray[100],
41
+ inputBorderRadius: theme.rounded.sm,
42
+ buttonBg: theme.colors.gray[800],
43
+ buttonBorder: theme.colors.gray[800],
44
+ booleanBg: theme.colors.gray[900],
45
+ booleanSelectedBg: theme.colors.gray[800],
46
+ });
47
+ }
@@ -0,0 +1,47 @@
1
+ import { create } from "storybook/theming";
2
+
3
+ export function getThemeLight(theme) {
4
+ return create({
5
+ base: "light",
6
+
7
+ /* Fonts */
8
+ fontBase: theme.fontBase,
9
+ fontCode: theme.fontCode,
10
+
11
+ /* Brand block */
12
+ brandTitle: theme.brandTitle,
13
+ brandUrl: theme.brandUrl,
14
+ brandImage: theme.brandImageLight,
15
+ brandTarget: theme.brandTarget,
16
+
17
+ /* Main colors */
18
+ colorPrimary: theme.colors.gray[900],
19
+ colorSecondary: theme.colors.gray[500],
20
+
21
+ /* UI */
22
+ appBg: theme.colors.white,
23
+ appPreviewBg: theme.colors.gray[50],
24
+ appBorderColor: theme.colors.gray[300],
25
+ appBorderRadius: 0,
26
+
27
+ /* Text colors */
28
+ textColor: theme.colors.gray[900],
29
+ textInverseColor: theme.colors.gray[900],
30
+
31
+ /* Toolbar default and active colors */
32
+ barTextColor: theme.colors.gray[500],
33
+ barHoverColor: theme.colors.gray[600],
34
+ barSelectedColor: theme.colors.gray[700],
35
+ barBg: theme.colors.gray[50],
36
+
37
+ /* Form colors */
38
+ inputBg: theme.colors.white,
39
+ inputBorder: theme.colors.gray[300],
40
+ inputTextColor: theme.colors.gray[900],
41
+ inputBorderRadius: theme.rounded.sm,
42
+ buttonBg: theme.colors.gray[100],
43
+ buttonBorder: theme.colors.gray[200],
44
+ booleanBg: theme.colors.gray[50],
45
+ booleanSelectedBg: theme.colors.gray[200],
46
+ });
47
+ }
@@ -0,0 +1,42 @@
1
+ import { create } from "storybook/theming";
2
+
3
+ export function getThemeLightPreview(theme) {
4
+ return create({
5
+ base: "light",
6
+
7
+ /* Fonts */
8
+ fontBase: theme.fontBase,
9
+ fontCode: theme.fontCode,
10
+
11
+ /* Main colors */
12
+ colorPrimary: theme.colors.gray[900],
13
+ colorSecondary: theme.colors.gray[500],
14
+
15
+ /* UI */
16
+ appBg: theme.colors.gray[100],
17
+ appPreviewBg: theme.colors.gray[50],
18
+ appBorderColor: theme.colors.gray[200],
19
+ appContentBg: theme.colors.gray[50],
20
+ appBorderRadius: theme.rounded.lg,
21
+
22
+ /* Text colors */
23
+ textColor: theme.colors.gray[900],
24
+ textInverseColor: theme.colors.gray[50],
25
+
26
+ /* Toolbar default and active colors */
27
+ barTextColor: theme.colors.gray[500],
28
+ barHoverColor: theme.colors.gray[600],
29
+ barSelectedColor: theme.colors.gray[700],
30
+ barBg: theme.colors.white,
31
+
32
+ /* Form colors */
33
+ inputBg: theme.colors.white,
34
+ inputBorder: theme.colors.gray[300],
35
+ inputTextColor: theme.colors.gray[900],
36
+ inputBorderRadius: theme.rounded.sm,
37
+ buttonBg: theme.colors.gray[100],
38
+ buttonBorder: theme.colors.gray[200],
39
+ booleanBg: theme.colors.gray[50],
40
+ booleanSelectedBg: theme.colors.gray[200],
41
+ });
42
+ }