@vueless/storybook 1.2.7-beta.1 → 1.2.7-beta.3

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.
@@ -3,8 +3,12 @@ import { defineConfigWithVueless } from "@vueless/storybook";
3
3
 
4
4
  export default defineConfigWithVueless({
5
5
  stories: [
6
- /* Define a path to your own component stories. */
7
- // "../src/**/stories.{js,jsx,ts,tsx}",
6
+ /* Path to the project component stories. */
7
+ // "../src/**/stories.js",
8
8
  // "../src/**/docs.mdx",
9
+ //
10
+ /* Path to the custom vueless component stories. */
11
+ // "../.vueless/components/**/stories.js",
12
+ // "../.vueless/components/**/docs.mdx",
9
13
  ],
10
14
  });
@@ -3,8 +3,12 @@ import { defineConfigWithVueless } from "@vueless/storybook";
3
3
 
4
4
  export default defineConfigWithVueless({
5
5
  stories: [
6
- /* Define a path to your own component stories. */
7
- // "../src/**/stories.{js,jsx,ts,tsx}",
6
+ /* Path to the project component stories. */
7
+ // "../src/**/stories.ts",
8
8
  // "../src/**/docs.mdx",
9
+ //
10
+ /* Path to the custom vueless component stories. */
11
+ // "../.vueless/components/**/stories.ts",
12
+ // "../.vueless/components/**/docs.mdx",
9
13
  ],
10
14
  });
package/index.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  export function defineConfigWithVueless(config) {
19
19
  return (async () => ({
20
20
  ...config,
21
- stories: [...config.stories, ...(await getVuelessStoriesGlob(config?.vuelessEnv))],
21
+ stories: [...(config.stories || []), ...(await getVuelessStoriesGlob(config?.vuelessEnv))],
22
22
  addons: [
23
23
  ...new Set([
24
24
  ...(config.addons || []),
@@ -30,12 +30,12 @@ export function defineConfigWithVueless(config) {
30
30
  ],
31
31
  staticDirs: ["public"],
32
32
  framework: {
33
- ...config.framework,
33
+ ...(config.framework || {}),
34
34
  name: "@storybook/vue3-vite",
35
35
  options: {
36
- ...config.framework?.options,
36
+ ...(config.framework?.options || {}),
37
37
  builder: {
38
- ...config.framework?.options?.builder,
38
+ ...(config.framework?.options?.builder || {}),
39
39
  viteConfigPath: ".storybook/vite.config.js",
40
40
  },
41
41
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueless/storybook",
3
- "version": "1.2.7-beta.1",
3
+ "version": "1.2.7-beta.3",
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",
@@ -17,27 +17,28 @@
17
17
  "lint:fix": "eslint --fix src/",
18
18
  "lint:ci": "eslint --no-fix --max-warnings=0",
19
19
  "release:prepare": "rm -rf dist && mkdir -p dist && cp -r src/. package.json LICENSE README.md dist/",
20
- "release:beta": "release-it --ci --npm.publish --preRelease=beta --increment=prerelease",
21
- "release:patch": "release-it patch --ci --npm.publish --git.tag --github.release",
22
- "release:minor": "release-it minor --ci --npm.publish --git.tag --github.release",
23
- "release:major": "release-it major --ci --npm.publish --git.tag --github.release"
20
+ "release:beta": "release-it --increment=prerelease --preRelease=beta --ci --no-git.tag --no-github.release",
21
+ "release:patch": "release-it patch --ci",
22
+ "release:minor": "release-it minor --ci",
23
+ "release:major": "release-it major --ci"
24
24
  },
25
25
  "dependencies": {
26
- "@storybook/addon-docs": "9.1.5",
27
- "@storybook/addon-links": "9.1.5",
28
- "@storybook/addon-themes": "9.1.5",
29
- "@storybook/vue3-vite": "9.1.5",
26
+ "@storybook/addon-docs": "^9.1.10",
27
+ "@storybook/addon-links": "^9.1.10",
28
+ "@storybook/addon-themes": "^9.1.10",
29
+ "@storybook/vue3-vite": "^9.1.10",
30
30
  "@vueless/storybook-dark-mode": "^9.0.8",
31
31
  "chokidar": "^4.0.3",
32
32
  "esbuild": "^0.25.9",
33
33
  "globby": "^14.1.0",
34
34
  "mkdirp": "^3.0.1",
35
35
  "prettier2": "npm:prettier@2.8.8",
36
- "storybook": "9.1.5",
36
+ "storybook": "^9.1.10",
37
37
  "vue-docgen-api": "^4.79.2"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@release-it/bumper": "^7.0.5",
41
+ "@release-it/conventional-changelog": "^10.0.1",
41
42
  "@stylistic/eslint-plugin": "^5.2.3",
42
43
  "@types/node": "^24.3.0",
43
44
  "@vitejs/plugin-vue": "^6.0.1",
@@ -51,10 +52,11 @@
51
52
  "tailwindcss": "^4.1.12",
52
53
  "typescript": "^5.9.2",
53
54
  "typescript-eslint": "^8.40.0",
55
+ "vite": "^7.1.9",
54
56
  "vue": "latest",
55
57
  "vue-router": "latest",
56
58
  "vue-tsc": "^3.0.6",
57
- "vueless": "^1.2.2"
59
+ "vueless": "^1.2.5"
58
60
  },
59
61
  "type": "module",
60
62
  "main": "index.js",
@@ -71,6 +73,7 @@
71
73
  "vue": "latest",
72
74
  "vue-template-compiler": "latest"
73
75
  },
76
+ "conventional-changelog-conventionalcommits": "8.0.0",
74
77
  "storybook": "$storybook"
75
78
  },
76
79
  "resolutions": {
@@ -6,6 +6,7 @@ import chokidar from "chokidar";
6
6
  import { globbySync } from "globby";
7
7
  import { parse } from "vue-docgen-api";
8
8
  import _ from "lodash-es";
9
+ import { VUELESS_USER_COMPONENTS_DIR, VUELESS_LIBRARY } from "vueless/constants.js";
9
10
 
10
11
  export default async function build(config, vuelessConfig, srcDir) {
11
12
  config.outFile = path.resolve(config.cwd, config.outFile);
@@ -111,6 +112,25 @@ export function getDefaultConfigJson(fileContents) {
111
112
  return (0, eval)("(" + objectString + ")"); // Converting into JS object
112
113
  }
113
114
 
115
+ /**
116
+ * Retrieves the default values from the provided component custom properties.
117
+ */
118
+ export function getCustomPropsDefaults(props) {
119
+ const customPropsDefaults = {};
120
+
121
+ if (!props) {
122
+ return customPropsDefaults;
123
+ }
124
+
125
+ for (const [key, value] of Object.entries(props)) {
126
+ if (value.default) {
127
+ customPropsDefaults[key] = value.default;
128
+ }
129
+ }
130
+
131
+ return customPropsDefaults;
132
+ }
133
+
114
134
  function getDefaultConfigFileName(folderPath) {
115
135
  const folder = fs.readdirSync(path.dirname(folderPath));
116
136
 
@@ -138,7 +158,11 @@ function getType(prop) {
138
158
  async function extractInformation(absolutePath, config, vuelessConfig) {
139
159
  const doc = await parse(config.cwd + "/" + absolutePath, {
140
160
  /* Allow to parse vueless components from node_modules. */
141
- validExtends: (filePath) => filePath.replace(/\\/g, "/").includes(config.srcDir),
161
+ validExtends: (filePath) => {
162
+ const path = filePath.replace(/\\/g, "/");
163
+
164
+ return path.includes(config.srcDir) || path.includes(VUELESS_USER_COMPONENTS_DIR);
165
+ },
142
166
  ...config.apiOptions,
143
167
  });
144
168
  const name = doc.name || doc.displayName;
@@ -154,11 +178,12 @@ async function extractInformation(absolutePath, config, vuelessConfig) {
154
178
  defaultConfig = getDefaultConfigJson(defaultConfigContent);
155
179
  }
156
180
 
157
- const globalConfigComponents = vuelessConfig?.component || {};
181
+ const globalConfigComponents = vuelessConfig?.components || {};
158
182
 
159
183
  const defaults = _.merge(
160
184
  defaultConfig?.defaults || {},
161
185
  globalConfigComponents[name]?.defaults || {},
186
+ getCustomPropsDefaults(globalConfigComponents[name]?.props),
162
187
  );
163
188
 
164
189
  doc.docsBlocks?.forEach((block) => {
@@ -175,7 +200,7 @@ async function extractInformation(absolutePath, config, vuelessConfig) {
175
200
 
176
201
  const componentPath = ensureRelative(path.relative(config.cwd, absolutePath));
177
202
  // Prevent "Chose declaration" duplication issue in Intellij
178
- const source = !componentPath.includes("vueless")
203
+ const source = !componentPath.includes(VUELESS_LIBRARY)
179
204
  ? { source: { module: componentPath, symbol: doc.exportName } }
180
205
  : {};
181
206
 
@@ -4,8 +4,14 @@ import { cwd } from "node:process";
4
4
  import { readFile } from "fs/promises";
5
5
  import { pathToFileURL } from "node:url";
6
6
  import esbuild from "esbuild";
7
+ import {
8
+ VUELESS_CACHE_DIR,
9
+ VUELESS_LOCAL_DIR,
10
+ VUELESS_PACKAGE_DIR,
11
+ SRC_USER_COMPONENTS_DIR,
12
+ VUELESS_USER_COMPONENTS_DIR,
13
+ } from "vueless/constants.js";
7
14
 
8
- const CACHE_PATH = "./node_modules/.cache/vueless";
9
15
  const WEB_TYPES_CONFIG_FILE_NAME = "web-types.config";
10
16
 
11
17
  export async function extractConfig() {
@@ -15,13 +21,17 @@ export async function extractConfig() {
15
21
  const config = await getConfig();
16
22
 
17
23
  const components = config?.isVuelessEnv
18
- ? ["src/**/*.vue"]
19
- : ["node_modules/vueless/**/*.vue", "src/components/**/*.vue", ".vueless/components/**/*.vue"];
24
+ ? [`${VUELESS_LOCAL_DIR}/**/*.vue`]
25
+ : [
26
+ `${VUELESS_PACKAGE_DIR}/**/*.vue`,
27
+ `${SRC_USER_COMPONENTS_DIR}/**/*.vue`,
28
+ `${VUELESS_USER_COMPONENTS_DIR}/**/*.vue`,
29
+ ];
20
30
 
21
31
  return {
22
32
  cwd: cwd(),
23
33
  components,
24
- outFile: `${CACHE_PATH}/web-types.json`,
34
+ outFile: `./${VUELESS_CACHE_DIR}/web-types.json`,
25
35
  packageName: packageJson["name"],
26
36
  packageVersion: packageJson["version"],
27
37
  descriptionMarkup: "markdown",
@@ -33,7 +43,7 @@ export async function extractConfig() {
33
43
  async function getConfig() {
34
44
  const configPathJs = path.resolve(cwd(), `${WEB_TYPES_CONFIG_FILE_NAME}.js`);
35
45
  const configPathTs = path.resolve(cwd(), `${WEB_TYPES_CONFIG_FILE_NAME}.ts`);
36
- const configOutPath = path.join(cwd(), `${CACHE_PATH}/${WEB_TYPES_CONFIG_FILE_NAME}.mjs`);
46
+ const configOutPath = path.join(cwd(), `${VUELESS_CACHE_DIR}/${WEB_TYPES_CONFIG_FILE_NAME}.mjs`);
37
47
 
38
48
  let config = {};
39
49