vueless 0.0.193 → 0.0.194
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/composable.ui/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ref,
|
|
3
|
+
watch,
|
|
3
4
|
watchEffect,
|
|
4
5
|
getCurrentInstance,
|
|
5
6
|
toValue,
|
|
@@ -69,7 +70,6 @@ export default function useUI(defaultConfig = {}, propsConfigGetter = null, topL
|
|
|
69
70
|
});
|
|
70
71
|
|
|
71
72
|
function getAttrs(configKey, options) {
|
|
72
|
-
const cvaClasses = options?.classes || "";
|
|
73
73
|
const nestedComponent = options?.isComponent || getNestedComponent(defaultConfig[configKey]); // TODO: Remove `options?.isComponent` when all `attrs.composable.js` will be migranted
|
|
74
74
|
|
|
75
75
|
const attrs = useAttrs();
|
|
@@ -87,7 +87,9 @@ export default function useUI(defaultConfig = {}, propsConfigGetter = null, topL
|
|
|
87
87
|
// Delete value key to prevent v-model overwrite
|
|
88
88
|
delete commonAttrs.value;
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
watch(config, updateVuelessAttrs, { immediate: true });
|
|
91
|
+
|
|
92
|
+
function updateVuelessAttrs() {
|
|
91
93
|
const configKeyValue = config.value[configKey];
|
|
92
94
|
const isObject = typeof configKeyValue === "object";
|
|
93
95
|
|
|
@@ -97,16 +99,15 @@ export default function useUI(defaultConfig = {}, propsConfigGetter = null, topL
|
|
|
97
99
|
};
|
|
98
100
|
|
|
99
101
|
const isTopLevelClassKey = configKey === (topLevelClassKey || firstClassKey);
|
|
100
|
-
|
|
101
102
|
const attrClass = isTopLevelClassKey && !nestedComponent ? attrs.class : "";
|
|
102
|
-
const
|
|
103
|
+
const classes = options?.classes ? toValue(options?.classes) : getBaseClasses(configKeyValue);
|
|
103
104
|
|
|
104
105
|
vuelessAttrs.value = {
|
|
105
106
|
...commonAttrs,
|
|
106
|
-
class: cx([
|
|
107
|
+
class: cx([classes, attrClass]),
|
|
107
108
|
...((isObject && configAttrs) || {}),
|
|
108
109
|
};
|
|
109
|
-
}
|
|
110
|
+
}
|
|
110
111
|
|
|
111
112
|
return vuelessAttrs;
|
|
112
113
|
}
|
|
@@ -261,6 +262,8 @@ function mergeConfigs({
|
|
|
261
262
|
@returns {Object}
|
|
262
263
|
*/
|
|
263
264
|
function stringToObject(value) {
|
|
265
|
+
if (value === undefined) value = "";
|
|
266
|
+
|
|
264
267
|
return typeof value === "object" ? value : { base: value };
|
|
265
268
|
}
|
|
266
269
|
|
|
@@ -359,13 +362,22 @@ function mergeClassesIntoConfig(config, topLevelClassKey, attrs) {
|
|
|
359
362
|
return config;
|
|
360
363
|
}
|
|
361
364
|
|
|
365
|
+
/**
|
|
366
|
+
Return base classes.
|
|
367
|
+
@param { String | Object } value
|
|
368
|
+
@returns { String }
|
|
369
|
+
*/
|
|
370
|
+
function getBaseClasses(value) {
|
|
371
|
+
return typeof value === "object" ? value.base || "" : value || "";
|
|
372
|
+
}
|
|
373
|
+
|
|
362
374
|
/**
|
|
363
375
|
Check is config key contains component name and if contains return it.
|
|
364
376
|
@param { String | Object } value
|
|
365
377
|
@returns { String }
|
|
366
378
|
*/
|
|
367
379
|
function getNestedComponent(value) {
|
|
368
|
-
const classes =
|
|
380
|
+
const classes = getBaseClasses(value);
|
|
369
381
|
const match = classes.match(nestedComponentRegEx);
|
|
370
382
|
|
|
371
383
|
return match ? match[1] : "";
|
package/package.json
CHANGED
|
@@ -21,20 +21,19 @@ export default function useAttrs(props, { isTop, isOpen, selectedLabel: selected
|
|
|
21
21
|
for (const key in defaultConfig) {
|
|
22
22
|
if (isSystemKey(key)) continue;
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const classes = computed(() => {
|
|
25
|
+
const value = config.value[key];
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
classes = computed(() =>
|
|
31
|
-
getCVA({
|
|
27
|
+
if (value.variants || value.compoundVariants) {
|
|
28
|
+
return cva(value)({
|
|
32
29
|
...props,
|
|
33
30
|
error: Boolean(props.error),
|
|
34
31
|
label: Boolean(props.label),
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return "";
|
|
36
|
+
});
|
|
38
37
|
|
|
39
38
|
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
40
39
|
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.194",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -7347,7 +7347,7 @@
|
|
|
7347
7347
|
"kind": "expression",
|
|
7348
7348
|
"type": "string|number|array"
|
|
7349
7349
|
},
|
|
7350
|
-
"default": "
|
|
7350
|
+
"default": "\"\""
|
|
7351
7351
|
},
|
|
7352
7352
|
{
|
|
7353
7353
|
"name": "options",
|