vueless 1.2.3-beta.5 → 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.
@@ -1,3 +1,3 @@
1
1
  export const SRC_COMPONENTS_PATH: "/src/components";
2
2
  export const COMPONENTS_PATH: "/components";
3
- export const DEFAULT_VUELESS_CONFIG_CONTENT: "import { componentConfigs } from \"./.vueless\";\n\nexport default {\n /**\n * Global settings.\n */\n primary: \"grayscale\",\n neutral: \"gray\",\n text: 14,\n outline: 2,\n rounding: 8,\n disabledOpacity: 50,\n colorMode: \"auto\",\n\n /**\n * Component settings.\n */\n components: /*tw*/ {\n ...componentConfigs,\n },\n\n /**\n * Directive settings.\n */\n directives: {},\n\n /**\n * Light theme CSS variable settings.\n */\n lightTheme: {\n /* Primary colors */\n \"--vl-primary\": \"--vl-primary-600\",\n \"--vl-primary-lifted\": \"--vl-primary-700\",\n \"--vl-primary-accented\": \"--vl-primary-800\",\n\n /* Secondary colors */\n \"--vl-secondary\": \"--vl-neutral-500\",\n \"--vl-secondary-lifted\": \"--vl-neutral-600\",\n \"--vl-secondary-accented\": \"--vl-neutral-700\",\n\n /* Success colors */\n \"--vl-success\": \"--color-green-600\",\n \"--vl-success-lifted\": \"--color-green-700\",\n \"--vl-success-accented\": \"--color-green-800\",\n\n /* Info colors */\n \"--vl-info\": \"--color-blue-600\",\n \"--vl-info-lifted\": \"--color-blue-700\",\n \"--vl-info-accented\": \"--color-blue-800\",\n\n /* Notice colors */\n \"--vl-notice\": \"--color-violet-600\",\n \"--vl-notice-lifted\": \"--color-violet-700\",\n \"--vl-notice-accented\": \"--color-violet-800\",\n\n /* Warning colors */\n \"--vl-warning\": \"--color-orange-600\",\n \"--vl-warning-lifted\": \"--color-orange-700\",\n \"--vl-warning-accented\": \"--color-orange-800\",\n\n /* Error colors */\n \"--vl-error\": \"--color-red-600\",\n \"--vl-error-lifted\": \"--color-red-700\",\n \"--vl-error-accented\": \"--color-red-800\",\n\n /* Grayscale colors */\n \"--vl-grayscale\": \"--vl-neutral-900\",\n \"--vl-grayscale-lifted\": \"--vl-neutral-800\",\n \"--vl-grayscale-accented\": \"--vl-neutral-700\",\n\n /* Neutral colors */\n \"--vl-neutral\": \"--vl-neutral-500\",\n \"--vl-neutral-lifted\": \"--vl-neutral-600\",\n \"--vl-neutral-accented\": \"--vl-neutral-700\",\n\n /* Text neutral colors */\n \"--vl-text-inverted\": \"--color-white\",\n \"--vl-text-muted\": \"--vl-neutral-400\",\n \"--vl-text-lifted\": \"--vl-neutral-500\",\n \"--vl-text-accented\": \"--vl-neutral-600\",\n \"--vl-text\": \"--vl-neutral-900\",\n\n /* Border neutral colors */\n \"--vl-border-muted\": \"--vl-neutral-200\",\n \"--vl-border\": \"--vl-neutral-300\",\n \"--vl-border-lifted\": \"--vl-neutral-400\",\n \"--vl-border-accented\": \"--vl-neutral-600\",\n\n /* Background neutral colors */\n \"--vl-bg\": \"--color-white\",\n \"--vl-bg-muted\": \"--vl-neutral-50\",\n \"--vl-bg-lifted\": \"--vl-neutral-100\",\n \"--vl-bg-accented\": \"--vl-neutral-200\",\n \"--vl-bg-inverted\": \"--vl-neutral-900\",\n },\n\n /**\n * Dark theme CSS variable settings.\n */\n darkTheme: {\n /* Primary colors */\n \"--vl-primary\": \"--vl-primary-400\",\n \"--vl-primary-lifted\": \"--vl-primary-500\",\n \"--vl-primary-accented\": \"--vl-primary-600\",\n\n /* Secondary colors */\n \"--vl-secondary\": \"--vl-neutral-300\",\n \"--vl-secondary-lifted\": \"--vl-neutral-400\",\n \"--vl-secondary-accented\": \"--vl-neutral-500\",\n\n /* Success colors */\n \"--vl-success\": \"--color-green-400\",\n \"--vl-success-lifted\": \"--color-green-500\",\n \"--vl-success-accented\": \"--color-green-600\",\n\n /* Info colors */\n \"--vl-info\": \"--color-blue-400\",\n \"--vl-info-lifted\": \"--color-blue-500\",\n \"--vl-info-accented\": \"--color-blue-600\",\n\n /* Notice colors */\n \"--vl-notice\": \"--color-violet-400\",\n \"--vl-notice-lifted\": \"--color-violet-500\",\n \"--vl-notice-accented\": \"--color-violet-600\",\n\n /* Warning colors */\n \"--vl-warning\": \"--color-orange-400\",\n \"--vl-warning-lifted\": \"--color-orange-500\",\n \"--vl-warning-accented\": \"--color-orange-600\",\n\n /* Error colors */\n \"--vl-error\": \"--color-red-400\",\n \"--vl-error-lifted\": \"--color-red-500\",\n \"--vl-error-accented\": \"--color-red-600\",\n\n /* Grayscale colors */\n \"--vl-grayscale\": \"--vl-neutral-100\",\n \"--vl-grayscale-lifted\": \"--vl-neutral-200\",\n \"--vl-grayscale-accented\": \"--vl-neutral-300\",\n\n /* Neutral colors */\n \"--vl-neutral\": \"--vl-neutral-300\",\n \"--vl-neutral-lifted\": \"--vl-neutral-400\",\n \"--vl-neutral-accented\": \"--vl-neutral-500\",\n\n /* Text neutral colors */\n \"--vl-text-inverted\": \"--vl-neutral-900\",\n \"--vl-text-muted\": \"--vl-neutral-600\",\n \"--vl-text-lifted\": \"--vl-neutral-400\",\n \"--vl-text-accented\": \"--vl-neutral-300\",\n \"--vl-text\": \"--vl-neutral-100\",\n\n /* Border neutral colors */\n \"--vl-border-muted\": \"--vl-neutral-800\",\n \"--vl-border\": \"--vl-neutral-700\",\n \"--vl-border-lifted\": \"--vl-neutral-600\",\n \"--vl-border-accented\": \"--vl-neutral-400\",\n\n /* Background neutral colors */\n \"--vl-bg\": \"--vl-neutral-900\",\n \"--vl-bg-muted\": \"--vl-neutral-800\",\n \"--vl-bg-lifted\": \"--vl-neutral-800\",\n \"--vl-bg-accented\": \"--vl-neutral-700\",\n \"--vl-bg-inverted\": \"--vl-neutral-100\",\n },\n};\n";
3
+ export const DEFAULT_VUELESS_CONFIG_CONTENT: "import { componentConfigs } from \"./.vueless\";\n\nexport default {\n /**\n * Global settings.\n */\n primary: \"grayscale\",\n neutral: \"gray\",\n text: 14,\n outline: 2,\n rounding: 8,\n letterSpacing: 0,\n disabledOpacity: 50,\n colorMode: \"auto\",\n\n /**\n * Component settings.\n */\n components: /*tw*/ {\n ...componentConfigs,\n },\n\n /**\n * Directive settings.\n */\n directives: {},\n\n /**\n * Light theme CSS variable settings.\n */\n lightTheme: {\n /* Primary colors */\n \"--vl-primary\": \"--vl-primary-600\",\n \"--vl-primary-lifted\": \"--vl-primary-700\",\n \"--vl-primary-accented\": \"--vl-primary-800\",\n\n /* Secondary colors */\n \"--vl-secondary\": \"--vl-neutral-500\",\n \"--vl-secondary-lifted\": \"--vl-neutral-600\",\n \"--vl-secondary-accented\": \"--vl-neutral-700\",\n\n /* Success colors */\n \"--vl-success\": \"--color-green-600\",\n \"--vl-success-lifted\": \"--color-green-700\",\n \"--vl-success-accented\": \"--color-green-800\",\n\n /* Info colors */\n \"--vl-info\": \"--color-blue-600\",\n \"--vl-info-lifted\": \"--color-blue-700\",\n \"--vl-info-accented\": \"--color-blue-800\",\n\n /* Notice colors */\n \"--vl-notice\": \"--color-violet-600\",\n \"--vl-notice-lifted\": \"--color-violet-700\",\n \"--vl-notice-accented\": \"--color-violet-800\",\n\n /* Warning colors */\n \"--vl-warning\": \"--color-orange-600\",\n \"--vl-warning-lifted\": \"--color-orange-700\",\n \"--vl-warning-accented\": \"--color-orange-800\",\n\n /* Error colors */\n \"--vl-error\": \"--color-red-600\",\n \"--vl-error-lifted\": \"--color-red-700\",\n \"--vl-error-accented\": \"--color-red-800\",\n\n /* Grayscale colors */\n \"--vl-grayscale\": \"--vl-neutral-900\",\n \"--vl-grayscale-lifted\": \"--vl-neutral-800\",\n \"--vl-grayscale-accented\": \"--vl-neutral-700\",\n\n /* Neutral colors */\n \"--vl-neutral\": \"--vl-neutral-500\",\n \"--vl-neutral-lifted\": \"--vl-neutral-600\",\n \"--vl-neutral-accented\": \"--vl-neutral-700\",\n\n /* Text neutral colors */\n \"--vl-text-inverted\": \"--color-white\",\n \"--vl-text-muted\": \"--vl-neutral-400\",\n \"--vl-text-lifted\": \"--vl-neutral-500\",\n \"--vl-text-accented\": \"--vl-neutral-600\",\n \"--vl-text\": \"--vl-neutral-900\",\n\n /* Border neutral colors */\n \"--vl-border-muted\": \"--vl-neutral-200\",\n \"--vl-border\": \"--vl-neutral-300\",\n \"--vl-border-lifted\": \"--vl-neutral-400\",\n \"--vl-border-accented\": \"--vl-neutral-600\",\n\n /* Background neutral colors */\n \"--vl-bg\": \"--color-white\",\n \"--vl-bg-muted\": \"--vl-neutral-50\",\n \"--vl-bg-lifted\": \"--vl-neutral-100\",\n \"--vl-bg-accented\": \"--vl-neutral-200\",\n \"--vl-bg-inverted\": \"--vl-neutral-900\",\n },\n\n /**\n * Dark theme CSS variable settings.\n */\n darkTheme: {\n /* Primary colors */\n \"--vl-primary\": \"--vl-primary-400\",\n \"--vl-primary-lifted\": \"--vl-primary-500\",\n \"--vl-primary-accented\": \"--vl-primary-600\",\n\n /* Secondary colors */\n \"--vl-secondary\": \"--vl-neutral-300\",\n \"--vl-secondary-lifted\": \"--vl-neutral-400\",\n \"--vl-secondary-accented\": \"--vl-neutral-500\",\n\n /* Success colors */\n \"--vl-success\": \"--color-green-400\",\n \"--vl-success-lifted\": \"--color-green-500\",\n \"--vl-success-accented\": \"--color-green-600\",\n\n /* Info colors */\n \"--vl-info\": \"--color-blue-400\",\n \"--vl-info-lifted\": \"--color-blue-500\",\n \"--vl-info-accented\": \"--color-blue-600\",\n\n /* Notice colors */\n \"--vl-notice\": \"--color-violet-400\",\n \"--vl-notice-lifted\": \"--color-violet-500\",\n \"--vl-notice-accented\": \"--color-violet-600\",\n\n /* Warning colors */\n \"--vl-warning\": \"--color-orange-400\",\n \"--vl-warning-lifted\": \"--color-orange-500\",\n \"--vl-warning-accented\": \"--color-orange-600\",\n\n /* Error colors */\n \"--vl-error\": \"--color-red-400\",\n \"--vl-error-lifted\": \"--color-red-500\",\n \"--vl-error-accented\": \"--color-red-600\",\n\n /* Grayscale colors */\n \"--vl-grayscale\": \"--vl-neutral-100\",\n \"--vl-grayscale-lifted\": \"--vl-neutral-200\",\n \"--vl-grayscale-accented\": \"--vl-neutral-300\",\n\n /* Neutral colors */\n \"--vl-neutral\": \"--vl-neutral-300\",\n \"--vl-neutral-lifted\": \"--vl-neutral-400\",\n \"--vl-neutral-accented\": \"--vl-neutral-500\",\n\n /* Text neutral colors */\n \"--vl-text-inverted\": \"--vl-neutral-900\",\n \"--vl-text-muted\": \"--vl-neutral-600\",\n \"--vl-text-lifted\": \"--vl-neutral-400\",\n \"--vl-text-accented\": \"--vl-neutral-300\",\n \"--vl-text\": \"--vl-neutral-100\",\n\n /* Border neutral colors */\n \"--vl-border-muted\": \"--vl-neutral-800\",\n \"--vl-border\": \"--vl-neutral-700\",\n \"--vl-border-lifted\": \"--vl-neutral-600\",\n \"--vl-border-accented\": \"--vl-neutral-400\",\n\n /* Background neutral colors */\n \"--vl-bg\": \"--vl-neutral-900\",\n \"--vl-bg-muted\": \"--vl-neutral-800\",\n \"--vl-bg-lifted\": \"--vl-neutral-800\",\n \"--vl-bg-accented\": \"--vl-neutral-700\",\n \"--vl-bg-inverted\": \"--vl-neutral-100\",\n },\n};\n";
package/bin/constants.js CHANGED
@@ -12,6 +12,7 @@ export default {
12
12
  text: 14,
13
13
  outline: 2,
14
14
  rounding: 8,
15
+ letterSpacing: 0,
15
16
  disabledOpacity: 50,
16
17
  colorMode: "auto",
17
18
 
package/constants.d.ts CHANGED
@@ -8,6 +8,7 @@ export const TEXT: "text";
8
8
  export const OUTLINE: "outline";
9
9
  export const ROUNDING: "rounding";
10
10
  export const DISABLED_OPACITY: "disabled-opacity";
11
+ export const LETTER_SPACING: "letter-spacing";
11
12
  export const COLOR_MODE_KEY: "vl-color-mode";
12
13
  export const AUTO_MODE_KEY: "vl-auto-mode";
13
14
  export const DARK_MODE_CLASS: "vl-dark";
@@ -24,6 +25,7 @@ export const DEFAULT_ROUNDING: 8;
24
25
  export const ROUNDING_DECREMENT: 4;
25
26
  export const ROUNDING_INCREMENT: 6;
26
27
  export const DEFAULT_DISABLED_OPACITY: 50;
28
+ export const DEFAULT_LETTER_SPACING: 0;
27
29
  export const PRIMARY_COLORS: string[];
28
30
  export const STATE_COLORS: string[];
29
31
  export const NEUTRAL_COLORS: string[];
package/constants.js CHANGED
@@ -16,6 +16,7 @@ export const TEXT = "text";
16
16
  export const OUTLINE = "outline";
17
17
  export const ROUNDING = "rounding";
18
18
  export const DISABLED_OPACITY = "disabled-opacity";
19
+ export const LETTER_SPACING = "letter-spacing";
19
20
 
20
21
  /* Vueless color mode keys */
21
22
  export const COLOR_MODE_KEY = "vl-color-mode";
@@ -36,6 +37,7 @@ export const DEFAULT_ROUNDING = 8; /* pixels */
36
37
  export const ROUNDING_DECREMENT = 4; /* pixels */
37
38
  export const ROUNDING_INCREMENT = 6; /* pixels */
38
39
  export const DEFAULT_DISABLED_OPACITY = 50; /* presents */
40
+ export const DEFAULT_LETTER_SPACING = 0; /* em */
39
41
 
40
42
  /* Vueless supported color shades */
41
43
  export const PRIMARY_COLORS = [
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.5",
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",
@@ -68,8 +69,15 @@
68
69
  "vitest": "^3.2.4",
69
70
  "vue": "^3.5.18",
70
71
  "vue-router": "^4.5.1",
71
- "vue-tsc": "^3.0.4",
72
- "vueless": "^1.2.1-beta.2"
72
+ "vue-tsc": "^3.0.4"
73
+ },
74
+ "peerDependencies": {
75
+ "vue-router": "^4.5.0"
76
+ },
77
+ "peerDependenciesMeta": {
78
+ "vue-router": {
79
+ "optional": true
80
+ }
73
81
  },
74
82
  "sideEffects": false,
75
83
  "style": "tailwind.css",
package/tailwind.css CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  @layer base {
24
24
  body {
25
- @apply antialiased text-(--vl-text) bg-(--vl-bg) scheme-light dark:scheme-dark;
25
+ @apply antialiased text-(--vl-text) bg-(--vl-bg) tracking-(--vl-letter-spacing) scheme-light dark:scheme-dark;
26
26
  }
27
27
 
28
28
  [type='checkbox']:checked {
package/types.ts CHANGED
@@ -113,6 +113,11 @@ export interface ThemeConfig {
113
113
  */
114
114
  outline?: number | Partial<ThemeConfigOutline>;
115
115
 
116
+ /**
117
+ * Default components letter spacing.
118
+ */
119
+ letterSpacing?: number;
120
+
116
121
  /**
117
122
  * Default components opacity for disabled state (in percents).
118
123
  */
@@ -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 {
package/utils/theme.ts CHANGED
@@ -33,6 +33,8 @@ import {
33
33
  TEXT_DECREMENT,
34
34
  DISABLED_OPACITY,
35
35
  DEFAULT_DISABLED_OPACITY,
36
+ LETTER_SPACING,
37
+ DEFAULT_LETTER_SPACING,
36
38
  } from "../constants";
37
39
 
38
40
  import type {
@@ -52,6 +54,7 @@ declare interface RootCSSVariableOptions {
52
54
  text: ThemeConfigText;
53
55
  rounding: ThemeConfigRounding;
54
56
  outline: ThemeConfigOutline;
57
+ letterSpacing: number;
55
58
  disabledOpacity: number;
56
59
  lightTheme: Partial<VuelessCssVariables>;
57
60
  darkTheme: Partial<VuelessCssVariables>;
@@ -150,6 +153,7 @@ export function setTheme(config: ThemeConfig = {}, isCachedAutoMode?: boolean) {
150
153
  const text = getText(config.text);
151
154
  const outline = getOutlines(config.outline);
152
155
  const rounding = getRoundings(config.rounding);
156
+ const letterSpacing = getLetterSpacing(config.letterSpacing);
153
157
  const disabledOpacity = getDisabledOpacity(config.disabledOpacity);
154
158
 
155
159
  let primary = getPrimaryColor(config.primary);
@@ -215,6 +219,7 @@ export function setTheme(config: ThemeConfig = {}, isCachedAutoMode?: boolean) {
215
219
  text,
216
220
  outline,
217
221
  rounding,
222
+ letterSpacing,
218
223
  disabledOpacity,
219
224
  lightTheme,
220
225
  darkTheme,
@@ -443,6 +448,24 @@ function getRoundings(rounding?: ThemeConfig["rounding"]) {
443
448
  return mergedRounding;
444
449
  }
445
450
 
451
+ /**
452
+ * Retrieve letter spacing value and save them to cookie and localStorage.
453
+ * @return number - letter spacing value.
454
+ */
455
+ function getLetterSpacing(letterSpacing?: ThemeConfig["letterSpacing"]) {
456
+ const storageKey = `vl-${LETTER_SPACING}`;
457
+
458
+ const spacing = letterSpacing ?? getStored(storageKey) ?? vuelessConfig.letterSpacing;
459
+ const mergedSpacing = Number(spacing ?? DEFAULT_LETTER_SPACING);
460
+
461
+ if (isCSR && letterSpacing) {
462
+ setCookie(storageKey, String(mergedSpacing));
463
+ localStorage.setItem(storageKey, String(mergedSpacing));
464
+ }
465
+
466
+ return mergedSpacing;
467
+ }
468
+
446
469
  /**
447
470
  * Retrieve disabled opacity value and save them to cookie and localStorage.
448
471
  * @return number - opacity value.
@@ -487,6 +510,7 @@ function setRootCSSVariables(vars: RootCSSVariableOptions) {
487
510
  "--vl-rounding-sm": `${vars.rounding.sm / PX_IN_REM}rem`,
488
511
  "--vl-rounding-md": `${vars.rounding.md / PX_IN_REM}rem`,
489
512
  "--vl-rounding-lg": `${vars.rounding.lg / PX_IN_REM}rem`,
513
+ "--vl-letter-spacing": `${vars.letterSpacing}em`,
490
514
  "--vl-disabled-opacity": `${vars.disabledOpacity}%`,
491
515
  };
492
516
 
@@ -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
- }