@vueless/storybook 0.0.49 → 0.0.50

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,11 +1,32 @@
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
- });
1
+ import { DecoratorHelpers } from "@storybook/addon-themes";
2
+ import { setTheme } from "vueless";
3
+ import { COLOR_MODE_KEY } from "vueless/constants.js";
4
+
5
+ const { initializeThemeState, pluckThemeFromContext } = DecoratorHelpers;
6
+
7
+ export const storyDarkModeDecorator = () => {
8
+ const prefersColorSchemeDark = window.matchMedia("(prefers-color-scheme: dark)");
9
+ const preferScheme = prefersColorSchemeDark.matches ? "dark" : "light";
10
+ const cachedColorMode = localStorage.getItem(COLOR_MODE_KEY) || preferScheme;
11
+
12
+ initializeThemeState(["light", "dark"], cachedColorMode);
13
+
14
+ return (story, context) => {
15
+ const theme = pluckThemeFromContext(context);
16
+
17
+ setTheme({
18
+ // TODO: Remove this condition when all component will have dark classes
19
+ colorMode: process.env.NODE_ENV === "development" ? theme : "light",
20
+ });
21
+
22
+ return {
23
+ components: { story },
24
+ setup() {
25
+ return {
26
+ theme,
27
+ };
28
+ },
29
+ template: `<story />`,
30
+ };
31
+ };
32
+ };
@@ -374,7 +374,7 @@ body {
374
374
  /* -------------------- Storybook story preview -------------------- */
375
375
 
376
376
  .vl-dark {
377
- @apply min-h-full bg-gray-950;
377
+ @apply min-h-full bg-gray-900;
378
378
  }
379
379
 
380
380
  .vl-light {
@@ -1,7 +1,7 @@
1
1
  /** @type { import('@storybook/vue3-vite').StorybookConfig } */
2
2
  export default {
3
3
  stories: [
4
- "../node_modules/vueless/**/*stories.@(js|jsx|ts|tsx)",
4
+ "../node_modules/vueless/**/*stories@(js|jsx|ts|tsx)",
5
5
  "../node_modules/vueless/**/*.@(mdx)",
6
6
  "../src/**/*stories.@(js|jsx|ts|tsx)",
7
7
  "../src/**/*.@(mdx)",
@@ -1,6 +1,6 @@
1
1
  import { setup } from "@storybook/vue3";
2
- import { getRandomId } from "vueless/utils/utilUI.js";
3
- import { DARK_MODE_SELECTOR, LIGHT_MODE_SELECTOR } from "vueless/constants.js";
2
+
3
+ import { getRandomId } from "vueless";
4
4
 
5
5
  import themeLight from "./themes/themeLight.js";
6
6
  import themeDark from "./themes/themeDark.js";
@@ -15,11 +15,11 @@ import "./index.css";
15
15
  import { createVueless } from "vueless";
16
16
  import { createRouter, createWebHistory } from "vue-router";
17
17
 
18
+ const vueless = createVueless();
19
+ const router = createRouter({ history: createWebHistory(), routes: [] });
20
+
18
21
  /* Setup storybook */
19
22
  setup((app) => {
20
- const vueless = createVueless();
21
- const router = createRouter({ history: createWebHistory(), routes: [] });
22
-
23
23
  app.config.idPrefix = getRandomId();
24
24
 
25
25
  if (!app._context.config.globalProperties.$route) {
@@ -29,10 +29,7 @@ setup((app) => {
29
29
  });
30
30
 
31
31
  /* Set storybook decorators */
32
- export const decorators = [
33
- vue3SourceDecorator,
34
- storyDarkModeDecorator(DARK_MODE_SELECTOR, LIGHT_MODE_SELECTOR),
35
- ];
32
+ export const decorators = [vue3SourceDecorator, storyDarkModeDecorator()];
36
33
 
37
34
  /* Set storybook parameters */
38
35
  export const parameters = {
@@ -1,5 +1,5 @@
1
1
  /** @type {import('tailwindcss').Config} */
2
- import { vuelessContent, vuelessContentVue, vuelessPreset } from "vueless/preset.tailwind.js";
2
+ import { vuelessContent, vuelessContentVue, vuelessPreset } from "vueless/preset-tailwind";
3
3
 
4
4
  export default {
5
5
  content: [...vuelessContent, ...vuelessContentVue, "./.storybook/**/*.{js,ts,jsx,tsx,html}"],
@@ -1,8 +1,10 @@
1
1
  import { defineConfig } from "vite";
2
+ import tailwindcss from "tailwindcss";
3
+ import autoprefixer from "autoprefixer";
2
4
 
3
5
  // Plugins
4
6
  import Vue from "@vitejs/plugin-vue";
5
- import { Vueless } from "@vueless/plugin-vite";
7
+ import { Vueless } from "vueless/plugin-vite";
6
8
 
7
9
  export default defineConfig({
8
10
  plugins: [Vue(), Vueless({ mode: "storybook", env: "vueless", debug: false })],
@@ -10,6 +12,7 @@ export default defineConfig({
10
12
  include: [
11
13
  "cva",
12
14
  "tailwind-merge",
15
+ "@tailwindcss/forms",
13
16
  "prettier2",
14
17
  "prettier2/parser-html",
15
18
  "@storybook/blocks",
@@ -17,4 +20,9 @@ export default defineConfig({
17
20
  "@storybook/addon-themes",
18
21
  ],
19
22
  },
23
+ css: {
24
+ postcss: {
25
+ plugins: [tailwindcss, autoprefixer],
26
+ },
27
+ },
20
28
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueless/storybook",
3
- "version": "0.0.49",
3
+ "version": "0.0.50",
4
4
  "description": "Simplifies Storybook configuration for Vueless UI library.",
5
5
  "homepage": "https://vueless.com",
6
6
  "author": "Johnny Grid",
@@ -49,7 +49,7 @@
49
49
  "prettier-eslint": "^16.3.0",
50
50
  "release-it": "^17.2.1",
51
51
  "vue-router": "^4.3.2",
52
- "vueless": "^0.0.439"
52
+ "vueless": "^0.0.589"
53
53
  },
54
54
  "resolutions": {
55
55
  "jackspeak": "2.3.6"
@@ -1,6 +0,0 @@
1
- export default {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- },
6
- };