vueless 0.0.635 → 0.0.637
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
CHANGED
|
@@ -43,11 +43,13 @@ export interface UDatePickerProps<TModelValue> {
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* Datepicker open direction on x-axis.
|
|
46
|
+
* @extendOnly
|
|
46
47
|
*/
|
|
47
48
|
openDirectionX?: "auto" | "left" | "right";
|
|
48
49
|
|
|
49
50
|
/**
|
|
50
51
|
* Datepicker open direction on y-axis.
|
|
52
|
+
* @extendOnly
|
|
51
53
|
*/
|
|
52
54
|
openDirectionY?: "auto" | "top" | "bottom";
|
|
53
55
|
|
|
@@ -96,11 +96,13 @@ export interface UDatePickerRangeProps<TModelValue> {
|
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* Datepicker open direction on x-axis.
|
|
99
|
+
* @extendOnly
|
|
99
100
|
*/
|
|
100
101
|
openDirectionX?: "auto" | "left" | "right";
|
|
101
102
|
|
|
102
103
|
/**
|
|
103
104
|
* Datepicker open direction on y-axis.
|
|
105
|
+
* @extendOnly
|
|
104
106
|
*/
|
|
105
107
|
openDirectionY?: "auto" | "top" | "bottom";
|
|
106
108
|
|
|
@@ -57,6 +57,10 @@ watchEffect(() => {
|
|
|
57
57
|
}, Number(props.debounce));
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
+
watchEffect(() => {
|
|
61
|
+
localValue.value = props.modelValue;
|
|
62
|
+
});
|
|
63
|
+
|
|
60
64
|
function onUpdateValue(value: string) {
|
|
61
65
|
localValue.value = value;
|
|
62
66
|
|
|
@@ -151,8 +155,8 @@ const {
|
|
|
151
155
|
@click="onClickClear"
|
|
152
156
|
/>
|
|
153
157
|
|
|
154
|
-
<!--
|
|
155
|
-
@slot Use it to add something after the text.
|
|
158
|
+
<!--
|
|
159
|
+
@slot Use it to add something after the text.
|
|
156
160
|
@binding {string} icon-name
|
|
157
161
|
-->
|
|
158
162
|
<slot
|
package/ui.form-select/types.ts
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
SYSTEM_CONFIG_KEY,
|
|
25
25
|
} from "../../constants.js";
|
|
26
26
|
|
|
27
|
+
const cwd = process.cwd();
|
|
27
28
|
const twMerge = extendTailwindMerge(merge(TAILWIND_MERGE_EXTENSION, vuelessConfig.tailwindMerge));
|
|
28
29
|
|
|
29
30
|
export const { cx } = defineConfig({
|
|
@@ -60,46 +61,38 @@ export async function createTailwindSafelist({ mode, env, debug, targetFiles = [
|
|
|
60
61
|
|
|
61
62
|
const vuelessFiles = [...srcVueFiles, ...vuelessVueFiles, ...vuelessConfigFiles];
|
|
62
63
|
|
|
64
|
+
const safelist = [];
|
|
65
|
+
|
|
63
66
|
const storybookColors = {
|
|
64
67
|
colors: [...BRAND_COLORS, BRAND_COLOR, GRAY_COLOR],
|
|
65
68
|
isComponentExists: true,
|
|
66
69
|
};
|
|
67
|
-
const safelist = [];
|
|
68
70
|
|
|
69
71
|
const componentNames = Object.keys(COMPONENTS);
|
|
70
72
|
|
|
71
|
-
for await (const
|
|
72
|
-
const defaultConfigPath = vuelessConfigFiles.find((file) =>
|
|
73
|
-
isDefaultComponentConfig(file, component),
|
|
74
|
-
);
|
|
75
|
-
const defaultConfig = await readFile(path.join(process.cwd(), defaultConfigPath), {
|
|
76
|
-
encoding: "utf-8",
|
|
77
|
-
});
|
|
78
|
-
const nestedComponents = (defaultConfig.match(/\{U\w+\}/g) || []).map(
|
|
79
|
-
(nestedComponentPattern) => nestedComponentPattern.replaceAll(/[{}]/g, ""),
|
|
80
|
-
);
|
|
81
|
-
|
|
73
|
+
for await (const componentName of componentNames) {
|
|
82
74
|
const { colors, isComponentExists } = isStorybookMode
|
|
83
75
|
? storybookColors
|
|
84
|
-
: await findComponentColors(vuelessFiles,
|
|
76
|
+
: await findComponentColors(componentName, vuelessFiles, vuelessConfigFiles);
|
|
77
|
+
|
|
78
|
+
const defaultConfig = await retrieveComponentDefaultConfig(componentName, vuelessConfigFiles);
|
|
79
|
+
const match = JSON.stringify(defaultConfig).match(/\{U\w+\}/g) || [];
|
|
80
|
+
|
|
81
|
+
const nestedComponents = match.map((nestedComponentPattern) =>
|
|
82
|
+
nestedComponentPattern.replaceAll(/[{}]/g, ""),
|
|
83
|
+
);
|
|
85
84
|
|
|
86
85
|
if (isComponentExists && colors.length) {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
vuelessConfigFiles,
|
|
90
|
-
isVuelessEnv,
|
|
91
|
-
});
|
|
86
|
+
const mergedConfig = await getMergedComponentConfig(componentName, vuelessConfigFiles);
|
|
87
|
+
const componentSafelist = await getComponentSafelist(mergedConfig, colors);
|
|
92
88
|
|
|
93
89
|
safelist.push(...componentSafelist);
|
|
94
90
|
}
|
|
95
91
|
|
|
96
92
|
if (isComponentExists && colors.length && nestedComponents.length) {
|
|
97
93
|
for await (const nestedComponent of nestedComponents) {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
vuelessConfigFiles,
|
|
101
|
-
isVuelessEnv,
|
|
102
|
-
});
|
|
94
|
+
const mergedConfig = await getMergedComponentConfig(nestedComponent, vuelessConfigFiles);
|
|
95
|
+
const nestedComponentSafelist = await getComponentSafelist(mergedConfig, colors);
|
|
103
96
|
|
|
104
97
|
safelist.push(...nestedComponentSafelist);
|
|
105
98
|
}
|
|
@@ -121,11 +114,11 @@ function getSafelistClasses(config) {
|
|
|
121
114
|
const safelistItems = [];
|
|
122
115
|
|
|
123
116
|
for (const key in config) {
|
|
117
|
+
if (key === SYSTEM_CONFIG_KEY.defaults) continue;
|
|
118
|
+
|
|
124
119
|
if (Object.prototype.hasOwnProperty.call(config, key)) {
|
|
125
120
|
const classes = config[key];
|
|
126
121
|
|
|
127
|
-
if (key === SYSTEM_CONFIG_KEY.defaults) continue;
|
|
128
|
-
|
|
129
122
|
if (typeof classes === "object" && Array.isArray(classes)) {
|
|
130
123
|
safelistItems.push(...classes.map(getSafelistClasses));
|
|
131
124
|
}
|
|
@@ -164,47 +157,46 @@ function getSafelistItem(safelistClass, colorString) {
|
|
|
164
157
|
}
|
|
165
158
|
}
|
|
166
159
|
|
|
167
|
-
async function getComponentSafelist(
|
|
168
|
-
|
|
169
|
-
isDefaultComponentConfig(file, componentName),
|
|
170
|
-
);
|
|
171
|
-
const customConfig = vuelessConfig.component?.[componentName] || {};
|
|
172
|
-
let defaultConfig = {};
|
|
173
|
-
|
|
174
|
-
if (defaultConfigPath) {
|
|
175
|
-
const configPath = path.join(process.cwd(), defaultConfigPath);
|
|
160
|
+
async function getComponentSafelist(mergedConfig, colors) {
|
|
161
|
+
const colorString = `(${colors.join("|")})`;
|
|
176
162
|
|
|
177
|
-
|
|
178
|
-
|
|
163
|
+
return getSafelistClasses(mergedConfig).map((safelistClass) =>
|
|
164
|
+
getSafelistItem(safelistClass, colorString),
|
|
165
|
+
);
|
|
166
|
+
}
|
|
179
167
|
|
|
168
|
+
async function getMergedComponentConfig(componentName, vuelessConfigFiles) {
|
|
180
169
|
const isStrategyValid =
|
|
181
170
|
vuelessConfig.strategy && Object.values(STRATEGY_TYPE).includes(vuelessConfig.strategy);
|
|
182
171
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
globalConfig: customConfig,
|
|
188
|
-
vuelessStrategy,
|
|
172
|
+
return getMergedConfig({
|
|
173
|
+
defaultConfig: await retrieveComponentDefaultConfig(componentName, vuelessConfigFiles),
|
|
174
|
+
globalConfig: vuelessConfig.component?.[componentName] || {},
|
|
175
|
+
vuelessStrategy: isStrategyValid ? vuelessConfig.strategy : STRATEGY_TYPE.merge,
|
|
189
176
|
});
|
|
177
|
+
}
|
|
190
178
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
getSafelistItem(safelistClass, colorString),
|
|
179
|
+
async function retrieveComponentDefaultConfig(componentName, vuelessConfigFiles) {
|
|
180
|
+
const componentDefaultConfigPath = vuelessConfigFiles.find((file) =>
|
|
181
|
+
isDefaultComponentConfig(file, componentName),
|
|
195
182
|
);
|
|
183
|
+
|
|
184
|
+
return componentDefaultConfigPath
|
|
185
|
+
? await getComponentDefaultConfig(componentName, path.join(cwd, componentDefaultConfigPath))
|
|
186
|
+
: {};
|
|
196
187
|
}
|
|
197
188
|
|
|
198
|
-
async function findComponentColors(files,
|
|
189
|
+
async function findComponentColors(componentName, files, vuelessConfigFiles) {
|
|
199
190
|
const objectColorRegExp = new RegExp(/\bcolor\s*:\s*["']([^"'\s]+)["']/, "g");
|
|
200
191
|
const singleColorRegExp = new RegExp(/\bcolor\s*=\s*["']([^"'\s]+)["']/);
|
|
201
192
|
const ternaryColorRegExp = new RegExp(/\bcolor="[^']*'([^']*)'\s*:\s*'([^']*)'/);
|
|
202
193
|
|
|
203
|
-
const
|
|
194
|
+
const mergedComponentConfig = await getMergedComponentConfig(componentName, vuelessConfigFiles);
|
|
195
|
+
const defaultColor = mergedComponentConfig.defaults?.color || vuelessConfig.brand || "";
|
|
204
196
|
const colors = new Set();
|
|
205
197
|
|
|
206
|
-
if (
|
|
207
|
-
colors.add(
|
|
198
|
+
if (defaultColor && defaultColor !== "grayscale") {
|
|
199
|
+
colors.add(defaultColor);
|
|
208
200
|
}
|
|
209
201
|
|
|
210
202
|
getSafelistColorsFromConfig().forEach((color) => colors.add(color));
|
|
@@ -253,13 +245,6 @@ async function findComponentColors(files, componentName) {
|
|
|
253
245
|
};
|
|
254
246
|
}
|
|
255
247
|
|
|
256
|
-
function getComponentBrandColor(componentName) {
|
|
257
|
-
const globalBrandColor = vuelessConfig.brand || "";
|
|
258
|
-
const globalComponentConfig = vuelessConfig.component?.[componentName] || {};
|
|
259
|
-
|
|
260
|
-
return vuelessConfig.component ? globalComponentConfig.defaults?.color : globalBrandColor;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
248
|
function isDefaultComponentConfig(filePath, componentName) {
|
|
264
249
|
const componentDirName = filePath.split(path.sep).at(-2);
|
|
265
250
|
|