vueless 1.2.3-beta.4 → 1.2.3-beta.6
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/bin/constants.d.ts +1 -1
- package/bin/constants.js +1 -0
- package/constants.d.ts +2 -0
- package/constants.js +2 -0
- package/package.json +2 -3
- package/tailwind.css +1 -1
- package/types.ts +5 -0
- package/utils/theme.ts +24 -0
package/bin/constants.d.ts
CHANGED
|
@@ -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
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "1.2.3-beta.
|
|
3
|
+
"version": "1.2.3-beta.6",
|
|
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",
|
|
@@ -68,8 +68,7 @@
|
|
|
68
68
|
"vitest": "^3.2.4",
|
|
69
69
|
"vue": "^3.5.18",
|
|
70
70
|
"vue-router": "^4.5.1",
|
|
71
|
-
"vue-tsc": "^3.0.4"
|
|
72
|
-
"vueless": "^1.2.1-beta.2"
|
|
71
|
+
"vue-tsc": "^3.0.4"
|
|
73
72
|
},
|
|
74
73
|
"sideEffects": false,
|
|
75
74
|
"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
|
*/
|
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
|
|