vueless 1.2.3-beta.6 → 1.2.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/modules.d.ts CHANGED
@@ -20,12 +20,6 @@ declare module "*.svg?skipsvgo" {
20
20
  export default component;
21
21
  }
22
22
 
23
- declare module "vueless/storybook" {
24
- import type { Config, UnknownObject } from "./types";
25
- export function defineConfigWithVueless(config: Config): Promise<UnknownObject>;
26
- export function getVuelessStoriesGlob(vuelessEnv: string): Promise<string[]>;
27
- }
28
-
29
23
  declare module "virtual:vueless/icons" {
30
24
  import type { UnknownArray } from "./types";
31
25
  export const cachedIcons: UnknownArray;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "1.2.3-beta.6",
3
+ "version": "1.2.3-beta.7",
4
4
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
5
5
  "author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
6
6
  "homepage": "https://vueless.com",
@@ -9,9 +9,10 @@
9
9
  "access": "public"
10
10
  },
11
11
  "scripts": {
12
- "dev:docs": "storybook dev -p 6006 --docs --no-open",
13
- "dev": "storybook dev -p 6006 --no-open",
14
- "build": "storybook build --docs",
12
+ "link:package": "rm -rf node_modules/vueless && ln -s ../src ./node_modules/vueless",
13
+ "dev:docs": "npm run link:package && storybook dev -p 6006 --docs --no-open",
14
+ "dev": "npm run link:package && storybook dev -p 6006 --no-open",
15
+ "build": "npm run link:package && storybook build --docs",
15
16
  "preview": "vite preview --host --outDir=storybook-static",
16
17
  "ts:check": "vue-tsc --build --force",
17
18
  "release:icons": "npx node .scripts/icons",
@@ -21,8 +22,8 @@
21
22
  "release:patch": "release-it patch --ci --npm.publish --git.tag --github.release",
22
23
  "release:minor": "release-it minor --ci --npm.publish --git.tag --github.release",
23
24
  "release:major": "release-it major --ci --npm.publish --git.tag --github.release",
24
- "lint": "eslint --no-fix src/ test/ .storybook/ .vueless/",
25
- "lint:fix": "eslint --fix src/ test/ .storybook/ .vueless/",
25
+ "lint": "eslint --no-fix src/ test/ .storybook/ .vueless/ .scripts/",
26
+ "lint:fix": "eslint --fix src/ test/ .storybook/ .vueless/ .scripts/",
26
27
  "lint:ci": "eslint --no-fix --max-warnings=0",
27
28
  "test": "vitest",
28
29
  "test:ci": "vitest --run"
@@ -55,7 +56,7 @@
55
56
  "@vue/eslint-config-typescript": "^14.6.0",
56
57
  "@vue/test-utils": "^2.4.6",
57
58
  "@vue/tsconfig": "^0.7.0",
58
- "@vueless/storybook": "^1.1.3-beta.10",
59
+ "@vueless/storybook": "^1.2.1-beta.5",
59
60
  "eslint": "^9.32.0",
60
61
  "eslint-plugin-storybook": "^9.0.18",
61
62
  "eslint-plugin-vue": "^10.3.0",
@@ -70,6 +71,14 @@
70
71
  "vue-router": "^4.5.1",
71
72
  "vue-tsc": "^3.0.4"
72
73
  },
74
+ "peerDependencies": {
75
+ "vue-router": "^4.5.0"
76
+ },
77
+ "peerDependenciesMeta": {
78
+ "vue-router": {
79
+ "optional": true
80
+ }
81
+ },
73
82
  "sideEffects": false,
74
83
  "style": "tailwind.css",
75
84
  "types": "index.d.ts",
@@ -1,7 +1,7 @@
1
1
  import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/addon-docs/blocks";
2
2
  import { getSource } from "../../utils/storybook";
3
3
 
4
- import * as stories from "./stories.js";
4
+ import * as stories from "./stories";
5
5
  import defaultConfig from "../config?raw"
6
6
 
7
7
  <Meta of={stories} />
@@ -31,7 +31,10 @@ export default {
31
31
  },
32
32
  parameters: {
33
33
  docs: {
34
- ...getDocsDescription(ULink.__name),
34
+ ...getDocsDescription(
35
+ ULink.__name,
36
+ "For Vue projects <a href='https://router.vuejs.org' target='_blank'>VueRouter</a> needs to be installed.",
37
+ ),
35
38
  },
36
39
  },
37
40
  } as Meta;
@@ -3,7 +3,7 @@ import { getVuelessConfig } from "./vuelessConfig.js";
3
3
  export async function buildWebTypes({ vuelessSrcDir, basePath } = {}) {
4
4
  try {
5
5
  const vuelessConfig = await getVuelessConfig(basePath);
6
- const { default: build } = await import("@vueless/storybook/webTypes/index.js");
6
+ const { buildWebTypes: build } = await import("@vueless/storybook");
7
7
 
8
8
  await build(vuelessConfig, vuelessSrcDir);
9
9
  } catch (error) {
@@ -334,7 +334,7 @@ export function getSlotsFragment(defaultTemplate: string) {
334
334
  /**
335
335
  * Create story param config to show component description with a link on GitHub.
336
336
  */
337
- export function getDocsDescription(componentName: string | undefined) {
337
+ export function getDocsDescription(componentName: string | undefined, afterText = "") {
338
338
  if (!componentName) {
339
339
  return {};
340
340
  }
@@ -342,7 +342,7 @@ export function getDocsDescription(componentName: string | undefined) {
342
342
  let viewOnGitHub = "";
343
343
 
344
344
  if (COMPONENTS[componentName as ComponentNames]) {
345
- viewOnGitHub = `| <a href="https://github.com/vuelessjs/vueless/tree/main/src/${COMPONENTS[componentName as ComponentNames]}" target="_blank">View on GitHub</a>`;
345
+ viewOnGitHub = `| <a href="https://github.com/vuelessjs/vueless/tree/main/src/${COMPONENTS[componentName as ComponentNames]}" target="_blank">View on GitHub</a><br/>${afterText}`;
346
346
  }
347
347
 
348
348
  return {
@@ -1 +0,0 @@
1
- export function defineConfigWithVueless(config: Object): Promise<Object>;
@@ -1,86 +0,0 @@
1
- import { getVuelessConfig } from "./vuelessConfig.js";
2
- import {
3
- COMPONENTS,
4
- DIRECTIVES,
5
- INTERNAL_ENV,
6
- VUELESS_LOCAL_DIR,
7
- VUELESS_PACKAGE_DIR,
8
- } from "../../constants.js";
9
-
10
- /**
11
- * Defines the config for Storybook.
12
- *
13
- * @param {Object} config - The config object.
14
- * @return {Promise<Object>} A promise that resolves to the modified config object.
15
- */
16
- export function defineConfigWithVueless(config) {
17
- return (async () => ({
18
- ...config,
19
- stories: [...config.stories, ...(await getVuelessStoriesGlob(config?.vuelessEnv))],
20
- addons: [
21
- ...new Set([
22
- ...(config.addons || []),
23
- "@storybook/addon-docs",
24
- "@storybook/addon-links",
25
- "@vueless/storybook-dark-mode",
26
- "@storybook/addon-themes",
27
- ]),
28
- ],
29
- staticDirs: ["public"],
30
- framework: {
31
- ...config.framework,
32
- name: "@storybook/vue3-vite",
33
- options: {
34
- ...config.framework?.options,
35
- builder: {
36
- ...config.framework?.options?.builder,
37
- viteConfigPath: ".storybook/vite.config.js",
38
- },
39
- },
40
- },
41
- env: (envConfig) => ({
42
- ...envConfig,
43
- BASE_URL: "/",
44
- }),
45
- }))();
46
- }
47
-
48
- /**
49
- * Retrieves the glob pattern for Vueless stories based on the provided Vueless environment.
50
- *
51
- * @param {string} vuelessEnv - The Vueless environment.
52
- * @return {Promise<string[]>} A promise that resolves to an array of glob patterns for Vueless stories.
53
- */
54
- async function getVuelessStoriesGlob(vuelessEnv) {
55
- const vuelessSrcDir = vuelessEnv === INTERNAL_ENV ? VUELESS_LOCAL_DIR : VUELESS_PACKAGE_DIR;
56
- const vuelessConfig = await getVuelessConfig();
57
- const storiesGlob = [];
58
-
59
- for (const [directiveName, directiveDir] of Object.entries(DIRECTIVES)) {
60
- const directiveGlobalConfig = vuelessConfig.directives?.[directiveName];
61
- const isHiddenStoriesByDirective = directiveGlobalConfig === false;
62
- const isHiddenStoriesByKey = directiveGlobalConfig?.storybook === false;
63
-
64
- if (isHiddenStoriesByDirective || isHiddenStoriesByKey) {
65
- continue;
66
- }
67
-
68
- storiesGlob.push(`../${vuelessSrcDir}/${directiveDir}/storybook/stories.{js,ts}`);
69
- storiesGlob.push(`../${vuelessSrcDir}/${directiveDir}/storybook/docs.mdx`);
70
- }
71
-
72
- for (const [componentName, componentDir] of Object.entries(COMPONENTS)) {
73
- const componentGlobalConfig = vuelessConfig.components?.[componentName];
74
- const isHiddenStoriesByComponent = componentGlobalConfig === false;
75
- const isHiddenStoriesByKey = componentGlobalConfig?.storybook === false;
76
-
77
- if (isHiddenStoriesByComponent || isHiddenStoriesByKey) {
78
- continue;
79
- }
80
-
81
- storiesGlob.push(`../${vuelessSrcDir}/${componentDir}/storybook/stories.{js,ts}`);
82
- storiesGlob.push(`../${vuelessSrcDir}/${componentDir}/storybook/docs.mdx`);
83
- }
84
-
85
- return storiesGlob;
86
- }