vueless 0.0.197 → 0.0.198
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
|
@@ -46,7 +46,8 @@ const SYSTEM_CONFIG_KEY = {
|
|
|
46
46
|
4. Component classes (class="...")
|
|
47
47
|
*/
|
|
48
48
|
export default function useUI(defaultConfig = {}, propsConfigGetter = null, topLevelClassKey) {
|
|
49
|
-
const {
|
|
49
|
+
const { type, props } = getCurrentInstance();
|
|
50
|
+
const componentName = type.name;
|
|
50
51
|
const globalConfig = globalComponentConfig[componentName];
|
|
51
52
|
|
|
52
53
|
const isStrategyValid = strategy && Object.values(STRATEGY_TYPE).includes(strategy);
|
|
@@ -88,6 +89,7 @@ export default function useUI(defaultConfig = {}, propsConfigGetter = null, topL
|
|
|
88
89
|
delete commonAttrs.value;
|
|
89
90
|
|
|
90
91
|
watch(config, updateVuelessAttrs, { immediate: true });
|
|
92
|
+
watch(props, updateVuelessAttrs);
|
|
91
93
|
|
|
92
94
|
function updateVuelessAttrs() {
|
|
93
95
|
const configKeyValue = config.value[configKey];
|
|
@@ -100,7 +102,7 @@ export default function useUI(defaultConfig = {}, propsConfigGetter = null, topL
|
|
|
100
102
|
|
|
101
103
|
const isTopLevelClassKey = configKey === (topLevelClassKey || firstClassKey);
|
|
102
104
|
const attrClass = isTopLevelClassKey && !nestedComponent ? attrs.class : "";
|
|
103
|
-
const classes =
|
|
105
|
+
const classes = toValue(options?.classes) || getBaseClasses(configKeyValue);
|
|
104
106
|
|
|
105
107
|
vuelessAttrs.value = {
|
|
106
108
|
...commonAttrs,
|
package/package.json
CHANGED
|
@@ -1,58 +1,40 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
2
|
import useUI from "../../composable.ui";
|
|
3
3
|
import { cva } from "../../service.ui";
|
|
4
|
-
|
|
5
4
|
import defaultConfig from "../configs/default.config";
|
|
6
5
|
|
|
7
|
-
export function useAttrs(props) {
|
|
8
|
-
const { config, getAttrs, getColor, setColor } = useUI(
|
|
9
|
-
|
|
6
|
+
export default function useAttrs(props) {
|
|
7
|
+
const { config, getAttrs, hasSlotContent, isSystemKey, getColor, setColor } = useUI(
|
|
8
|
+
defaultConfig,
|
|
9
|
+
() => props.config,
|
|
10
|
+
);
|
|
11
|
+
const attrs = {};
|
|
10
12
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
variants: button.variants,
|
|
14
|
-
compoundVariants: button.compoundVariants,
|
|
15
|
-
});
|
|
13
|
+
for (const key in defaultConfig) {
|
|
14
|
+
if (isSystemKey(key)) continue;
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
variants: text.variants,
|
|
20
|
-
compoundVariants: text.compoundVariants,
|
|
21
|
-
});
|
|
16
|
+
const classes = computed(() => {
|
|
17
|
+
const value = config.value[key];
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
filled: props.filled,
|
|
33
|
-
loading: props.loading,
|
|
34
|
-
disabled: props.disabled,
|
|
35
|
-
}),
|
|
36
|
-
props.color,
|
|
37
|
-
),
|
|
38
|
-
);
|
|
19
|
+
if (value.variants || value.compoundVariants) {
|
|
20
|
+
return setColor(
|
|
21
|
+
cva(value)({
|
|
22
|
+
...props,
|
|
23
|
+
color: getColor(props.color),
|
|
24
|
+
}),
|
|
25
|
+
props.color,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
39
28
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
cvaText({
|
|
43
|
-
color: getColor(props.color),
|
|
44
|
-
}),
|
|
45
|
-
props.color,
|
|
46
|
-
),
|
|
47
|
-
);
|
|
29
|
+
return "";
|
|
30
|
+
});
|
|
48
31
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const textAttrs = getAttrs("text", { classes: textClasses });
|
|
32
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
33
|
+
}
|
|
52
34
|
|
|
53
35
|
return {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
36
|
+
...attrs,
|
|
37
|
+
config,
|
|
38
|
+
hasSlotContent,
|
|
57
39
|
};
|
|
58
40
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UButton from "../ui.button";
|
|
4
4
|
import UIcon from "../ui.image-icon";
|
|
@@ -29,9 +29,7 @@ const DefaultTemplate = (args) => ({
|
|
|
29
29
|
},
|
|
30
30
|
template: `
|
|
31
31
|
<UButton v-bind="args">
|
|
32
|
-
|
|
33
|
-
<template v-if="args[slot]">{{ args[slot] }}</template>
|
|
34
|
-
</template>
|
|
32
|
+
${allSlotsFragment}
|
|
35
33
|
</UButton>
|
|
36
34
|
`,
|
|
37
35
|
});
|
package/ui.button/index.vue
CHANGED
|
@@ -39,7 +39,7 @@ import ULoader from "../ui.loader";
|
|
|
39
39
|
import UIcon from "../ui.image-icon";
|
|
40
40
|
|
|
41
41
|
import defaultConfig from "./configs/default.config";
|
|
42
|
-
import
|
|
42
|
+
import useAttrs from "./composables/attrs.composable";
|
|
43
43
|
import { UButton } from "./constants";
|
|
44
44
|
|
|
45
45
|
/* Should be a string for correct web-types gen */
|