@vueless/storybook 1.1.3-beta.5 → 1.1.3-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.
- package/{.storybook → .storybook-js}/main.js +1 -1
- package/.storybook-js/manager.js +34 -0
- package/{.storybook → .storybook-js}/preview.js +28 -29
- package/{.storybook → .storybook-js}/themes/themeDark.js +1 -1
- package/{.storybook → .storybook-js}/themes/themeLight.js +1 -1
- package/{.storybook → .storybook-js}/themes/themeLightPreview.js +1 -1
- package/{.storybook → .storybook-js}/vite.config.js +1 -0
- package/.storybook-ts/main.ts +10 -0
- package/.storybook-ts/manager-head.html +34 -0
- package/.storybook-ts/manager.ts +34 -0
- package/.storybook-ts/preview-head.html +11 -0
- package/.storybook-ts/preview.ts +79 -0
- package/.storybook-ts/public/favicons/favicon.ico +0 -0
- package/.storybook-ts/public/favicons/favicon.svg +4 -0
- package/.storybook-ts/public/images/vueless-logo-dark.svg +12 -0
- package/.storybook-ts/public/images/vueless-logo-light.svg +12 -0
- package/.storybook-ts/themes/manager.css +177 -0
- package/.storybook-ts/themes/preview.css +612 -0
- package/.storybook-ts/themes/themeDark.ts +45 -0
- package/.storybook-ts/themes/themeLight.ts +45 -0
- package/.storybook-ts/themes/themeLightPreview.ts +41 -0
- package/.storybook-ts/vite.config.ts +24 -0
- package/bin/index.js +6 -2
- package/decorators/storyDarkModeDecorator.js +21 -33
- package/package.json +11 -2
- package/.storybook/manager.js +0 -21
- /package/{.storybook → .storybook-js}/manager-head.html +0 -0
- /package/{.storybook → .storybook-js}/preview-head.html +0 -0
- /package/{.storybook → .storybook-js}/public/favicons/favicon.ico +0 -0
- /package/{.storybook → .storybook-js}/public/favicons/favicon.svg +0 -0
- /package/{.storybook → .storybook-js}/public/images/vueless-logo-dark.svg +0 -0
- /package/{.storybook → .storybook-js}/public/images/vueless-logo-light.svg +0 -0
- /package/{.storybook → .storybook-js}/themes/manager.css +0 -0
- /package/{.storybook → .storybook-js}/themes/preview.css +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { create } from "storybook/theming/create";
|
|
2
|
+
import type { ThemeVars } from "storybook/theming";
|
|
3
|
+
|
|
4
|
+
export const themeLightPreview: ThemeVars = create({
|
|
5
|
+
base: "light",
|
|
6
|
+
// Typography
|
|
7
|
+
fontBase: '"Roboto", sans-serif',
|
|
8
|
+
fontCode: "monospace",
|
|
9
|
+
|
|
10
|
+
// Main colors
|
|
11
|
+
colorPrimary: "#111827", // gray-900
|
|
12
|
+
colorSecondary: "#6b7280", // gray-500
|
|
13
|
+
|
|
14
|
+
// UI
|
|
15
|
+
appBg: "#f3f4f6", // gray-100
|
|
16
|
+
appPreviewBg: "#f9fafb", // gray-50
|
|
17
|
+
appBorderColor: "#e5e7eb", // gray-200
|
|
18
|
+
appContentBg: "#f9fafb", // gray-50
|
|
19
|
+
appBorderRadius: 8,
|
|
20
|
+
|
|
21
|
+
// Text colors
|
|
22
|
+
textColor: "#111827", // gray-900
|
|
23
|
+
textInverseColor: "#f9fafb", // gray-50
|
|
24
|
+
|
|
25
|
+
// Toolbar default and active colors
|
|
26
|
+
barTextColor: "#6b7280", // gray-500
|
|
27
|
+
barHoverColor: "#4b5563", // gray-600
|
|
28
|
+
barSelectedColor: "#374151", // gray-700
|
|
29
|
+
barBg: "#ffffff", // white
|
|
30
|
+
|
|
31
|
+
// Form colors
|
|
32
|
+
inputBg: "#ffffff", // white
|
|
33
|
+
inputBorder: "#d1d5db", // gray-300
|
|
34
|
+
inputTextColor: "#111827", // gray-900
|
|
35
|
+
inputBorderRadius: 4,
|
|
36
|
+
|
|
37
|
+
buttonBg: "#f3f4f6", // gray-100
|
|
38
|
+
buttonBorder: "#e5e7eb", // gray-200
|
|
39
|
+
booleanBg: "#f9fafb", // gray-50
|
|
40
|
+
booleanSelectedBg: "#e5e7eb", // gray-200
|
|
41
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
|
|
3
|
+
// Plugins
|
|
4
|
+
import Vue from "@vitejs/plugin-vue";
|
|
5
|
+
import { Vueless, TailwindCSS } from "vueless/plugin-vite";
|
|
6
|
+
import { STORYBOOK_ENV } from "vueless/constants.js";
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
plugins: [Vue(), TailwindCSS(), Vueless({ env: STORYBOOK_ENV })],
|
|
10
|
+
optimizeDeps: {
|
|
11
|
+
include: [
|
|
12
|
+
"cva",
|
|
13
|
+
"tailwind-merge",
|
|
14
|
+
"prettier2",
|
|
15
|
+
"prettier2/parser-html",
|
|
16
|
+
"@storybook/addon-docs/blocks",
|
|
17
|
+
"storybook/theming/create",
|
|
18
|
+
"storybook/internal/docs-tools",
|
|
19
|
+
"@storybook/addon-themes",
|
|
20
|
+
"@storybook/vue3-vite",
|
|
21
|
+
"@vueless/storybook",
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
});
|
package/bin/index.js
CHANGED
|
@@ -5,12 +5,16 @@ import path from "node:path";
|
|
|
5
5
|
import { cwd } from "node:process";
|
|
6
6
|
import { styleText } from "node:util";
|
|
7
7
|
import fs, { promises } from "node:fs";
|
|
8
|
+
import { detectTypeScript } from "vueless/utils/node/helper.js";
|
|
8
9
|
|
|
9
10
|
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
10
|
-
const
|
|
11
|
+
const sourceTs = path.join(__dirname, "..", ".storybook-ts");
|
|
12
|
+
const sourceJs = path.join(__dirname, "..", ".storybook-js");
|
|
11
13
|
const target = path.join(cwd(), ".storybook");
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
const hasTypeScript = await detectTypeScript();
|
|
16
|
+
|
|
17
|
+
hasTypeScript ? copyStorybookPreset(sourceTs, target) : copyStorybookPreset(sourceJs, target);
|
|
14
18
|
|
|
15
19
|
await addStorybookCommands();
|
|
16
20
|
|
|
@@ -1,49 +1,37 @@
|
|
|
1
1
|
import { DecoratorHelpers } from "@storybook/addon-themes";
|
|
2
|
+
import { makeDecorator } from "storybook/preview-api";
|
|
2
3
|
import { setTheme } from "vueless";
|
|
3
|
-
import { COLOR_MODE_KEY } from "vueless/constants.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/* Cache preview color mode. */
|
|
6
|
+
let previewColorMode = "";
|
|
6
7
|
|
|
8
|
+
/* Set Storybook color mode when system color mode changed. */
|
|
7
9
|
const prefersColorSchemeDark = window.matchMedia("(prefers-color-scheme: dark)");
|
|
8
10
|
|
|
9
11
|
prefersColorSchemeDark.addEventListener("change", (event) => {
|
|
10
|
-
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export const storyDarkModeDecorator = () => {
|
|
14
|
-
/* Set theme className to html tag before initialization (fix white blink issue). */
|
|
15
|
-
const sbAddonThemesConfig = localStorage.getItem("sb-addon-themes-3") || "{}";
|
|
16
|
-
const storybookTheme = JSON.parse(sbAddonThemesConfig).current || "light";
|
|
17
|
-
|
|
18
|
-
// this fixing first load
|
|
19
|
-
document.body.classList.add(storybookTheme);
|
|
12
|
+
const systemColorMode = event.matches ? "dark" : "light";
|
|
20
13
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
document.documentElement.classList.add(storybookTheme);
|
|
24
|
-
|
|
25
|
-
setTimeout(() => {
|
|
26
|
-
document.documentElement.classList.remove("light", "dark");
|
|
27
|
-
}, 4000);
|
|
28
|
-
}
|
|
14
|
+
setTheme({ colorMode: previewColorMode || systemColorMode });
|
|
15
|
+
});
|
|
29
16
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
/* Define color mode decorator. */
|
|
18
|
+
export const storyDarkModeDecorator = makeDecorator({
|
|
19
|
+
name: "storyDarkModeDecorator",
|
|
20
|
+
wrapper: (storyFn, context) => {
|
|
21
|
+
const sbAddonThemesConfig = localStorage.getItem("sb-addon-themes-3") || "{}";
|
|
22
|
+
const storybookColorMode = JSON.parse(sbAddonThemesConfig).current || "light";
|
|
23
|
+
const systemColorMode = prefersColorSchemeDark.matches ? "dark" : "light";
|
|
33
24
|
|
|
34
|
-
|
|
25
|
+
DecoratorHelpers.initializeThemeState(["light", "dark"], storybookColorMode || systemColorMode);
|
|
35
26
|
|
|
36
|
-
|
|
37
|
-
const theme = pluckThemeFromContext(context);
|
|
27
|
+
previewColorMode = DecoratorHelpers.pluckThemeFromContext(context);
|
|
38
28
|
|
|
39
|
-
setTheme({ colorMode:
|
|
29
|
+
setTheme({ colorMode: previewColorMode || systemColorMode });
|
|
40
30
|
|
|
41
31
|
return {
|
|
42
|
-
components: {
|
|
43
|
-
setup() {
|
|
44
|
-
return { theme };
|
|
45
|
-
},
|
|
32
|
+
components: { storyFn },
|
|
33
|
+
setup: () => ({ theme: previewColorMode }),
|
|
46
34
|
template: `<story />`,
|
|
47
35
|
};
|
|
48
|
-
}
|
|
49
|
-
};
|
|
36
|
+
},
|
|
37
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueless/storybook",
|
|
3
|
-
"version": "1.1.3-beta.
|
|
3
|
+
"version": "1.1.3-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",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"copy": "./bin/index.js"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
+
"ts:check": "vue-tsc --build --force",
|
|
17
18
|
"lint": "eslint --no-fix src/",
|
|
18
19
|
"lint:fix": "eslint --fix src/",
|
|
19
20
|
"lint:ci": "eslint --no-fix --max-warnings=0",
|
|
@@ -40,7 +41,9 @@
|
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@release-it/bumper": "^7.0.5",
|
|
42
43
|
"@stylistic/eslint-plugin": "^5.2.3",
|
|
44
|
+
"@tsconfig/node20": "^20.1.6",
|
|
43
45
|
"@types/node": "^24.3.0",
|
|
46
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
44
47
|
"eslint": "^9.33.0",
|
|
45
48
|
"eslint-config-prettier": "^10.1.8",
|
|
46
49
|
"eslint-plugin-node": "^11.1.0",
|
|
@@ -49,9 +52,15 @@
|
|
|
49
52
|
"prettier": "^3.6.2",
|
|
50
53
|
"release-it": "^19.0.4",
|
|
51
54
|
"tailwindcss": "^4.1.12",
|
|
55
|
+
"typescript": "^5.9.2",
|
|
56
|
+
"typescript-eslint": "^8.40.0",
|
|
52
57
|
"vue": "latest",
|
|
53
58
|
"vue-router": "latest",
|
|
54
|
-
"
|
|
59
|
+
"vue-tsc": "^3.0.6",
|
|
60
|
+
"vueless": "^1.2.1-beta.2"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"vueless": ">=1.2.0 <2.0.0"
|
|
55
64
|
},
|
|
56
65
|
"overrides": {
|
|
57
66
|
"vue-docgen-api": {
|
package/.storybook/manager.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { addons } from "storybook/manager-api";
|
|
2
|
-
|
|
3
|
-
/* Theme styles */
|
|
4
|
-
import "./themes/manager.css";
|
|
5
|
-
import themeDark from "./themes/themeDark.js";
|
|
6
|
-
import themeLight from "./themes/themeLight.js";
|
|
7
|
-
|
|
8
|
-
const prefersColorSchemeDark = window.matchMedia("(prefers-color-scheme: dark)");
|
|
9
|
-
|
|
10
|
-
function setSystemTheme(theme) {
|
|
11
|
-
addons.setConfig({
|
|
12
|
-
theme: theme ? themeDark : themeLight,
|
|
13
|
-
panelPosition: "right",
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
setSystemTheme(prefersColorSchemeDark.matches);
|
|
18
|
-
|
|
19
|
-
prefersColorSchemeDark.addEventListener("change", (event) => {
|
|
20
|
-
setSystemTheme(event.matches);
|
|
21
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|