vueless 0.0.476-0 → 0.0.477-beta.0
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/package.json +2 -2
- package/preset.tailwind.d.ts +45 -92
- package/{preset.tailwind.ts → preset.tailwind.js} +18 -17
- package/web-types.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.477-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
|
|
6
6
|
"keywords": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"ts:check": "vue-tsc --build --force --noEmit",
|
|
35
35
|
"ts:build": "vue-tsc --build --force --declaration --emitDeclarationOnly",
|
|
36
36
|
"release:prepare": "npx @vueless/web-types && node prepare.icons && rm -rf dist && mkdir -p dist && cp -r src/. package.json LICENSE web-types.json README.md dist/ && node prepare.package && npm run ts:build",
|
|
37
|
-
"release:beta": "release-it
|
|
37
|
+
"release:beta": "release-it prepatch --ci --npm.publish --preRelease=beta",
|
|
38
38
|
"release:patch": "release-it patch --ci --npm.publish",
|
|
39
39
|
"release:minor": "release-it minor --ci --npm.publish --git.tag --github.release",
|
|
40
40
|
"release:major": "release-it major --ci --npm.publish --git.tag --github.release",
|
package/preset.tailwind.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
darkMode: string[];
|
|
8
|
-
content: string[];
|
|
9
|
-
theme
|
|
10
|
-
extend
|
|
11
|
-
colors
|
|
12
|
-
brand:
|
|
13
|
-
gray:
|
|
14
|
-
cool: {
|
|
1
|
+
export function vuelessPreset(): Object;
|
|
2
|
+
export function getSafelist(): any[];
|
|
3
|
+
export const vuelessContent: string[];
|
|
4
|
+
export const vuelessContentVue: string[];
|
|
5
|
+
export const vuelessContentNuxt: string[];
|
|
6
|
+
export namespace vuelessTailwindConfig {
|
|
7
|
+
let darkMode: string[];
|
|
8
|
+
let content: string[];
|
|
9
|
+
namespace theme {
|
|
10
|
+
namespace extend {
|
|
11
|
+
namespace colors {
|
|
12
|
+
let brand: Object;
|
|
13
|
+
let gray: Object;
|
|
14
|
+
let cool: {
|
|
15
15
|
'50': "#f9fafb";
|
|
16
16
|
'100': "#f3f4f6";
|
|
17
17
|
'200': "#e5e7eb";
|
|
@@ -24,93 +24,46 @@ export declare const vuelessTailwindConfig: {
|
|
|
24
24
|
'900': "#111827";
|
|
25
25
|
'950': "#030712";
|
|
26
26
|
};
|
|
27
|
-
}
|
|
28
|
-
spacing: {
|
|
29
|
-
"safe-top": string;
|
|
30
|
-
"safe-bottom": string;
|
|
31
|
-
"safe-left": string;
|
|
32
|
-
"safe-right": string;
|
|
33
|
-
};
|
|
34
|
-
fontSize: {
|
|
35
|
-
"2xs": string[];
|
|
36
|
-
};
|
|
37
|
-
borderRadius: {
|
|
38
|
-
dynamic: string;
|
|
39
|
-
};
|
|
40
|
-
ringWidth: {
|
|
41
|
-
dynamic: string;
|
|
42
|
-
};
|
|
43
|
-
ringOffsetWidth: {
|
|
44
|
-
dynamic: string;
|
|
45
|
-
};
|
|
46
|
-
ringOffsetColor: {
|
|
47
|
-
dynamic: string;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
configViewer: {
|
|
51
|
-
themeReplacements: {
|
|
52
|
-
"var(--vl-ring)": number;
|
|
53
|
-
"var(--vl-ring-offset)": number;
|
|
54
|
-
"var(--vl-ring-offset-color)": string;
|
|
55
|
-
"var(--vl-rounding)": number;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
export declare function vuelessPreset(): {
|
|
61
|
-
plugins: (typeof forms)[];
|
|
62
|
-
safelist: any;
|
|
63
|
-
darkMode: string[];
|
|
64
|
-
content: string[];
|
|
65
|
-
theme: {
|
|
66
|
-
extend: {
|
|
67
|
-
colors: {
|
|
68
|
-
brand: Partial<TailwindColorShades>;
|
|
69
|
-
gray: Partial<TailwindColorShades>;
|
|
70
|
-
cool: {
|
|
71
|
-
'50': "#f9fafb";
|
|
72
|
-
'100': "#f3f4f6";
|
|
73
|
-
'200': "#e5e7eb";
|
|
74
|
-
'300': "#d1d5db";
|
|
75
|
-
'400': "#9ca3af";
|
|
76
|
-
'500': "#6b7280";
|
|
77
|
-
'600': "#4b5563";
|
|
78
|
-
'700': "#374151";
|
|
79
|
-
'800': "#1f2937";
|
|
80
|
-
'900': "#111827";
|
|
81
|
-
'950': "#030712";
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
spacing: {
|
|
27
|
+
}
|
|
28
|
+
let spacing: {
|
|
85
29
|
"safe-top": string;
|
|
86
30
|
"safe-bottom": string;
|
|
87
31
|
"safe-left": string;
|
|
88
32
|
"safe-right": string;
|
|
89
33
|
};
|
|
90
|
-
fontSize: {
|
|
34
|
+
let fontSize: {
|
|
91
35
|
"2xs": string[];
|
|
92
36
|
};
|
|
93
|
-
borderRadius
|
|
94
|
-
dynamic: string;
|
|
95
|
-
}
|
|
96
|
-
ringWidth
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
37
|
+
namespace borderRadius {
|
|
38
|
+
let dynamic: string;
|
|
39
|
+
}
|
|
40
|
+
namespace ringWidth {
|
|
41
|
+
let dynamic_1: string;
|
|
42
|
+
export { dynamic_1 as dynamic };
|
|
43
|
+
}
|
|
44
|
+
namespace ringOffsetWidth {
|
|
45
|
+
let dynamic_2: string;
|
|
46
|
+
export { dynamic_2 as dynamic };
|
|
47
|
+
}
|
|
48
|
+
namespace ringOffsetColor {
|
|
49
|
+
let dynamic_3: Function;
|
|
50
|
+
export { dynamic_3 as dynamic };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
namespace configViewer {
|
|
54
|
+
let themeReplacements: {
|
|
55
|
+
constructor: Function;
|
|
56
|
+
toString(): string;
|
|
57
|
+
toLocaleString(): string;
|
|
58
|
+
valueOf(): Object;
|
|
59
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
60
|
+
isPrototypeOf(v: Object): boolean;
|
|
61
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
108
62
|
"var(--vl-ring)": number;
|
|
109
63
|
"var(--vl-ring-offset)": number;
|
|
110
64
|
"var(--vl-ring-offset-color)": string;
|
|
111
65
|
"var(--vl-rounding)": number;
|
|
112
66
|
};
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
export declare function getSafelist(): any;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -15,13 +15,9 @@ import {
|
|
|
15
15
|
GRAYSCALE_COLOR,
|
|
16
16
|
} from "./constants.js";
|
|
17
17
|
|
|
18
|
-
import type { BrandColors, GrayColors, TailwindColorShades, TailwindSafelist } from "./types";
|
|
19
|
-
|
|
20
|
-
type TailwindColors = BrandColors | GrayColors | typeof GRAY_COLOR;
|
|
21
|
-
|
|
22
18
|
const isStrategyOverride = process.env.VUELESS_STRATEGY === "override";
|
|
23
|
-
const brandColor =
|
|
24
|
-
const grayColor =
|
|
19
|
+
const brandColor = process.env.VUELESS_BRAND || DEFAULT_BRAND_COLOR;
|
|
20
|
+
const grayColor = process.env.VUELESS_GRAY || DEFAULT_GRAY_COLOR;
|
|
25
21
|
|
|
26
22
|
/**
|
|
27
23
|
* Vueless Tailwind CSS `content` config.
|
|
@@ -114,6 +110,7 @@ export const vuelessTailwindConfig = {
|
|
|
114
110
|
|
|
115
111
|
/**
|
|
116
112
|
* Generates preset for TailwindCSS base on Vueless config.
|
|
113
|
+
* @returns {Object}
|
|
117
114
|
*/
|
|
118
115
|
export function vuelessPreset() {
|
|
119
116
|
return {
|
|
@@ -125,9 +122,10 @@ export function vuelessPreset() {
|
|
|
125
122
|
|
|
126
123
|
/**
|
|
127
124
|
* Convert sting patterns to RegExp.
|
|
125
|
+
* @returns {Array} - TailwindCSS safelist.
|
|
128
126
|
*/
|
|
129
127
|
export function getSafelist() {
|
|
130
|
-
return JSON.parse(process.env.VUELESS_SAFELIST || "[]").map((rule
|
|
128
|
+
return JSON.parse(process.env.VUELESS_SAFELIST || "[]").map((rule) => ({
|
|
131
129
|
...rule,
|
|
132
130
|
pattern: new RegExp(rule.pattern),
|
|
133
131
|
}));
|
|
@@ -135,23 +133,25 @@ export function getSafelist() {
|
|
|
135
133
|
|
|
136
134
|
/**
|
|
137
135
|
* Transform CSS variable with RGB numbers into CSS color.
|
|
136
|
+
* @param { String } variableName
|
|
137
|
+
* @returns {Function}
|
|
138
138
|
*/
|
|
139
|
-
function twColorWithOpacity(variableName
|
|
139
|
+
function twColorWithOpacity(variableName) {
|
|
140
140
|
return `rgba(var(${variableName}))`;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
144
|
* Convert sting patterns to RegExp.
|
|
145
|
+
* @param { String } color (gray | brand)
|
|
146
|
+
* @returns { Object } - TailwindCSS color object palette.
|
|
145
147
|
*/
|
|
146
|
-
function getPalette(color
|
|
147
|
-
const palette
|
|
148
|
+
function getPalette(color) {
|
|
149
|
+
const palette = {
|
|
148
150
|
DEFAULT: twColorWithOpacity(`--vl-color-${color}-default`),
|
|
149
151
|
};
|
|
150
152
|
|
|
151
153
|
COLOR_SHADES.forEach((shade) => {
|
|
152
|
-
palette[shade
|
|
153
|
-
`--vl-color-${color}-${shade}`,
|
|
154
|
-
);
|
|
154
|
+
palette[shade] = twColorWithOpacity(`--vl-color-${color}-${shade}`);
|
|
155
155
|
});
|
|
156
156
|
|
|
157
157
|
return palette;
|
|
@@ -159,8 +159,11 @@ function getPalette(color: string) {
|
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
161
|
* Prepare a color object for theme replacement to fix missing css color variables in `tailwind-config-viewer`.
|
|
162
|
+
* @param { String } color (gray | brand)
|
|
163
|
+
* @param { String } tailwindColor any tailwind color with pallet.
|
|
164
|
+
* @returns { Object } - `tailwind-config-viewer` color replacement object.
|
|
162
165
|
*/
|
|
163
|
-
function getReplacementColors(color
|
|
166
|
+
function getReplacementColors(color, tailwindColor) {
|
|
164
167
|
if (tailwindColor === GRAYSCALE_COLOR || tailwindColor === COOL_COLOR) {
|
|
165
168
|
tailwindColor = GRAY_COLOR;
|
|
166
169
|
}
|
|
@@ -170,9 +173,7 @@ function getReplacementColors(color: "gray" | "brand", tailwindColor: TailwindCo
|
|
|
170
173
|
};
|
|
171
174
|
|
|
172
175
|
COLOR_SHADES.forEach((shade) => {
|
|
173
|
-
varsPalette[twColorWithOpacity(`--vl-color-${color}-${shade}`)] =
|
|
174
|
-
tailwindColor
|
|
175
|
-
][shade];
|
|
176
|
+
varsPalette[twColorWithOpacity(`--vl-color-${color}-${shade}`)] = colors[tailwindColor][shade];
|
|
176
177
|
});
|
|
177
178
|
|
|
178
179
|
return varsPalette;
|