vueless 0.0.564 → 0.0.566
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/composables/useUI.ts +18 -11
- package/constants.js +0 -1
- package/package.json +1 -1
- package/ui.button-toggle/config.ts +1 -2
- package/ui.button-toggle-item/config.ts +1 -1
- package/ui.container-group/config.ts +1 -1
- package/ui.data-list/UDataList.vue +1 -1
- package/ui.data-table/config.ts +2 -2
- package/ui.dropdown-badge/config.ts +2 -4
- package/ui.dropdown-button/config.ts +1 -1
- package/ui.form-color-picker/config.js +2 -2
- package/ui.form-date-picker/config.ts +10 -4
- package/ui.form-date-picker-range/config.ts +8 -11
- package/ui.form-input-file/config.js +1 -1
- package/ui.form-input-number/config.js +1 -1
- package/ui.form-select/config.js +1 -1
- package/ui.text-file/config.ts +1 -2
- package/utils/node/mergeConfigs.js +2 -12
- package/web-types.json +1 -1
package/composables/useUI.ts
CHANGED
|
@@ -124,12 +124,9 @@ export default function useUI<T>(
|
|
|
124
124
|
keysAttrs[`${key}Attrs`] = getAttrs(key, getClasses(key, mutatedProps));
|
|
125
125
|
|
|
126
126
|
const baseClasses = getBaseClasses(config.value[key]);
|
|
127
|
-
const
|
|
127
|
+
const extendsKeys = getExtendsKeys(baseClasses);
|
|
128
128
|
|
|
129
|
-
if (
|
|
130
|
-
// retrieves extends keys from patterns:
|
|
131
|
-
// Example: `{>someKey} {>someOtherKey}` >>> `["someKey", "someOtherKey"]`.
|
|
132
|
-
const extendsKeys = extendsMatches.map((pattern) => pattern.slice(2, -1));
|
|
129
|
+
if (extendsKeys.length) {
|
|
133
130
|
const classes = getExtendingKeysClasses(extendsKeys, mutatedProps);
|
|
134
131
|
const extendsClasses = Object.values(classes).map((item) => toValue(item));
|
|
135
132
|
|
|
@@ -141,6 +138,10 @@ export default function useUI<T>(
|
|
|
141
138
|
...extendsClasses,
|
|
142
139
|
keyAttrs.value.class?.replaceAll(EXTENDS_PATTERN_REG_EXP, ""),
|
|
143
140
|
]),
|
|
141
|
+
config: getMergedConfig({
|
|
142
|
+
defaultConfig: config.value[extendsKeys[0]],
|
|
143
|
+
globalConfig: keyAttrs.value.config as Component,
|
|
144
|
+
}),
|
|
144
145
|
}));
|
|
145
146
|
}
|
|
146
147
|
}
|
|
@@ -204,15 +205,21 @@ function getBaseClasses(value: string | CVA | NestedComponent) {
|
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
/**
|
|
207
|
-
*
|
|
208
|
+
* Retrieves extends keys from patterns:
|
|
209
|
+
* Example: `{>someKey} {>someOtherKey}` >>> `["someKey", "someOtherKey"]`.
|
|
210
|
+
*/
|
|
211
|
+
function getExtendsKeys(values: string = ""): string[] {
|
|
212
|
+
const matches = values.match(EXTENDS_PATTERN_REG_EXP);
|
|
213
|
+
|
|
214
|
+
return matches ? matches?.map((pattern) => pattern.slice(2, -1)) : [];
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Check is config key contains component name and returns it.
|
|
208
219
|
*/
|
|
209
220
|
function getNestedComponent(value: string | NestedComponent | CVA) {
|
|
210
221
|
const classes = getBaseClasses(value);
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
const match =
|
|
214
|
-
classes.match(NESTED_COMPONENT_PATTERN_REG_EXP) ||
|
|
215
|
-
component?.match(NESTED_COMPONENT_PATTERN_REG_EXP);
|
|
222
|
+
const match = classes.match(NESTED_COMPONENT_PATTERN_REG_EXP);
|
|
216
223
|
|
|
217
224
|
return match ? match[1] : "";
|
|
218
225
|
}
|
package/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
toggleButton: {
|
|
3
|
-
component: "{UButton}",
|
|
4
3
|
base: `
|
|
4
|
+
{UButton}
|
|
5
5
|
border-gray-300 font-normal
|
|
6
6
|
hover:text-brand-600 hover:border-brand-600 hover:relative hover:z-10
|
|
7
7
|
focus:text-brand-600 focus:border-brand-600 focus:relative focus:z-10 focus:ring-brand-700/15
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
@binding {boolean} active
|
|
154
154
|
-->
|
|
155
155
|
<slot name="label" :item="item" :active="active">
|
|
156
|
-
<div v-bind="active ?
|
|
156
|
+
<div v-bind="active ? labelAttrs : labelCrossedAttrs" v-text="item[labelKey]" />
|
|
157
157
|
</slot>
|
|
158
158
|
</template>
|
|
159
159
|
|
package/ui.data-table/config.ts
CHANGED
|
@@ -71,12 +71,12 @@ export default /*tw*/ {
|
|
|
71
71
|
bodyCellNested: "mr-2 flex gap-0.5",
|
|
72
72
|
bodyCellNestedExpandIconWrapper: "",
|
|
73
73
|
bodyCellNestedExpandIcon: {
|
|
74
|
-
|
|
74
|
+
base: "{UIcon}",
|
|
75
75
|
wrapper: "rounded-sm",
|
|
76
76
|
container: "bg-gray-200",
|
|
77
77
|
},
|
|
78
78
|
bodyCellNestedCollapseIcon: {
|
|
79
|
-
|
|
79
|
+
base: "{UIcon}",
|
|
80
80
|
wrapper: "rounded-sm",
|
|
81
81
|
container: "bg-gray-200",
|
|
82
82
|
},
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: "relative inline-block",
|
|
3
3
|
dropdownBadge: {
|
|
4
|
-
|
|
5
|
-
base: "transition",
|
|
4
|
+
base: "{UBadge} transition",
|
|
6
5
|
variants: {
|
|
7
6
|
opened: {
|
|
8
7
|
true: "group ring-dynamic ring-offset-dynamic ring-{color}-700/15",
|
|
@@ -12,8 +11,7 @@ export default /*tw*/ {
|
|
|
12
11
|
},
|
|
13
12
|
dropdownIcon: "{UIcon} transition duration-300 group-[]:rotate-180",
|
|
14
13
|
dropdownList: {
|
|
15
|
-
|
|
16
|
-
base: "w-fit",
|
|
14
|
+
base: "{UDropdownList} w-fit",
|
|
17
15
|
variants: {
|
|
18
16
|
yPosition: {
|
|
19
17
|
top: "bottom-6 mb-6",
|
|
@@ -13,11 +13,11 @@ export default /*tw*/ {
|
|
|
13
13
|
unselected: "relative flex",
|
|
14
14
|
unselectedIcon: "{UIcon} absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",
|
|
15
15
|
unselectedColorPickerRadio: {
|
|
16
|
-
|
|
16
|
+
base: "{URadio}",
|
|
17
17
|
radio: "checked:text-white !border-gray-300",
|
|
18
18
|
},
|
|
19
19
|
colorPickerRadio: {
|
|
20
|
-
|
|
20
|
+
base: "{URadio}",
|
|
21
21
|
radio: `
|
|
22
22
|
bg-{color}-600 border-{color}-600 hover:border-{color}-600 active:bg-{color}-800
|
|
23
23
|
disabled:border-{color}-400 disabled:bg-{color}-400
|
|
@@ -2,12 +2,18 @@ export default /*tw*/ {
|
|
|
2
2
|
wrapper: "relative",
|
|
3
3
|
datepickerInput: "{UInput}",
|
|
4
4
|
datepickerInputActive: {
|
|
5
|
-
|
|
6
|
-
wrapper:
|
|
5
|
+
base: "{UInput} {>datepickerInput}",
|
|
6
|
+
wrapper: {
|
|
7
|
+
base: "ring-dynamic rounded-dynamic ring-offset-dynamic ring-brand-700/15 border-brand-500 hover:border-brand-500",
|
|
8
|
+
variants: {
|
|
9
|
+
error: {
|
|
10
|
+
true: "ring-red-700/15",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
7
14
|
},
|
|
8
15
|
calendar: {
|
|
9
|
-
|
|
10
|
-
base: "absolute mb-3 z-40",
|
|
16
|
+
base: "{UCalendar} absolute mb-3 z-40",
|
|
11
17
|
variants: {
|
|
12
18
|
openDirectionX: {
|
|
13
19
|
left: "left-0 right-auto",
|
|
@@ -2,12 +2,12 @@ export default /*tw*/ {
|
|
|
2
2
|
wrapper: "relative",
|
|
3
3
|
datepickerInput: "{UInput}",
|
|
4
4
|
datepickerInputActive: {
|
|
5
|
-
|
|
5
|
+
base: "{UInput} {>datepickerInput}",
|
|
6
6
|
wrapper: {
|
|
7
7
|
base: "ring-dynamic rounded-dynamic ring-offset-dynamic ring-brand-700/15 border-brand-500 hover:border-brand-500",
|
|
8
8
|
variants: {
|
|
9
9
|
error: {
|
|
10
|
-
true: "ring-red-
|
|
10
|
+
true: "ring-red-700/15",
|
|
11
11
|
},
|
|
12
12
|
},
|
|
13
13
|
},
|
|
@@ -23,10 +23,7 @@ export default /*tw*/ {
|
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
|
-
button: {
|
|
27
|
-
component: "{UButton}",
|
|
28
|
-
base: "shrink-0 grow rounded-none",
|
|
29
|
-
},
|
|
26
|
+
button: "{UButton} shrink-0 grow rounded-none",
|
|
30
27
|
shiftRangeButton: `
|
|
31
28
|
first:rounded-dynamic first:rounded-r-none
|
|
32
29
|
last:rounded-dynamic last:rounded-l-none
|
|
@@ -87,9 +84,9 @@ export default /*tw*/ {
|
|
|
87
84
|
customRangeDescription: "",
|
|
88
85
|
rangeInputWrapper: "flex mt-4 -space-x-px group/range-input-wrapper",
|
|
89
86
|
rangeInputFirst: {
|
|
90
|
-
|
|
87
|
+
base: "{UInput}",
|
|
91
88
|
inputLabel: {
|
|
92
|
-
|
|
89
|
+
base: "{ULabel}",
|
|
93
90
|
wrapper: "w-full hover:z-10 focus:z-10 !rounded-none",
|
|
94
91
|
description: "hidden",
|
|
95
92
|
},
|
|
@@ -100,9 +97,9 @@ export default /*tw*/ {
|
|
|
100
97
|
`,
|
|
101
98
|
},
|
|
102
99
|
rangeInputLast: {
|
|
103
|
-
|
|
100
|
+
base: "{UInput}",
|
|
104
101
|
inputLabel: {
|
|
105
|
-
|
|
102
|
+
base: "{ULabel}",
|
|
106
103
|
wrapper: "w-full hover:z-10 focus:z-10",
|
|
107
104
|
description: "hidden",
|
|
108
105
|
},
|
|
@@ -114,7 +111,7 @@ export default /*tw*/ {
|
|
|
114
111
|
},
|
|
115
112
|
rangeInputError: "text-xs font-normal leading-none mt-2 text-center text-red-500",
|
|
116
113
|
calendar: {
|
|
117
|
-
|
|
114
|
+
base: "{UCalendar}",
|
|
118
115
|
wrapper: "p-0 pt-2 w-full border-none shadow-none rounded-none",
|
|
119
116
|
navigation: "pb-0 mb-0 border-none",
|
|
120
117
|
day: "w-full",
|
package/ui.form-select/config.js
CHANGED
package/ui.text-file/config.ts
CHANGED
|
@@ -24,7 +24,7 @@ export function createMergeConfigs(cx) {
|
|
|
24
24
|
const isPropsConfig = Object.keys(propsConfig).length;
|
|
25
25
|
|
|
26
26
|
// Add unique keys from defaultConfig to composedConfig
|
|
27
|
-
const composedConfig = cloneDeep(defaultConfig);
|
|
27
|
+
const composedConfig = cloneDeep(stringToObject(defaultConfig, { addBase: true }));
|
|
28
28
|
|
|
29
29
|
// Add unique keys from globalConfig to composedConfig
|
|
30
30
|
for (const key in globalConfig) {
|
|
@@ -45,7 +45,6 @@ export function createMergeConfigs(cx) {
|
|
|
45
45
|
defaults,
|
|
46
46
|
strategy,
|
|
47
47
|
safelist,
|
|
48
|
-
component,
|
|
49
48
|
safelistColors,
|
|
50
49
|
defaultVariants,
|
|
51
50
|
compoundVariants,
|
|
@@ -58,15 +57,6 @@ export function createMergeConfigs(cx) {
|
|
|
58
57
|
// eslint-disable-next-line no-console
|
|
59
58
|
console.warn(`Passing '${key}' key in 'config' prop is not allowed.`);
|
|
60
59
|
}
|
|
61
|
-
} else if (key === component) {
|
|
62
|
-
config[key] = propsConfig[key] || defaultConfig[key];
|
|
63
|
-
|
|
64
|
-
if (globalConfig[key]) {
|
|
65
|
-
// eslint-disable-next-line no-console
|
|
66
|
-
console.warn(
|
|
67
|
-
`Passing '${key}' key in 'config' prop or by global config is not allowed.`,
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
60
|
} else if (key === strategy) {
|
|
71
61
|
config[key] = propsConfig[key] || globalConfig[key] || defaultConfig[key];
|
|
72
62
|
} else if (key === defaults || key === defaultVariants) {
|
|
@@ -231,7 +221,7 @@ export function createGetMergedConfig(cx) {
|
|
|
231
221
|
const strategy =
|
|
232
222
|
!globalConfig && !propsConfig
|
|
233
223
|
? STRATEGY_TYPE.merge
|
|
234
|
-
: propsConfig?.strategy || globalConfig?.strategy || vuelessStrategy;
|
|
224
|
+
: propsConfig?.strategy || globalConfig?.strategy || vuelessStrategy || STRATEGY_TYPE.merge;
|
|
235
225
|
|
|
236
226
|
if (strategy === STRATEGY_TYPE.merge) {
|
|
237
227
|
mergedConfig = mergeConfigs({ defaultConfig, globalConfig, propsConfig });
|