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.
@@ -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 extendsMatches = baseClasses.match(EXTENDS_PATTERN_REG_EXP);
127
+ const extendsKeys = getExtendsKeys(baseClasses);
128
128
 
129
- if (extendsMatches) {
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
- * Check is config key contains component name and if contains return it.
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 component = (value as NestedComponent)?.component as ComponentNames;
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
@@ -67,7 +67,6 @@ export const SYSTEM_CONFIG_KEY = {
67
67
  defaults: "defaults",
68
68
  strategy: "strategy",
69
69
  safelist: "safelist",
70
- component: "component",
71
70
  transition: "transition",
72
71
  safelistColors: "safelistColors",
73
72
  ...CVA_CONFIG_KEY,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.564",
3
+ "version": "0.0.566",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -1,7 +1,6 @@
1
1
  export default /*tw*/ {
2
2
  toggleLabel: {
3
- component: "{ULabel}",
4
- base: "flex flex-wrap",
3
+ base: "{ULabel} flex flex-wrap",
5
4
  variants: {
6
5
  block: {
7
6
  true: "w-full",
@@ -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
@@ -2,7 +2,7 @@ export default /*tw*/ {
2
2
  wrapper: "w-full",
3
3
  upperline: "{UDivider}",
4
4
  underline: {
5
- component: "{UDivider}",
5
+ base: "{UDivider}",
6
6
  variants: {
7
7
  underlined: {
8
8
  true: "pt-1.5",
@@ -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 ? labelCrossedAttrs : labelAttrs" v-text="item[labelKey]" />
156
+ <div v-bind="active ? labelAttrs : labelCrossedAttrs" v-text="item[labelKey]" />
157
157
  </slot>
158
158
  </template>
159
159
 
@@ -71,12 +71,12 @@ export default /*tw*/ {
71
71
  bodyCellNested: "mr-2 flex gap-0.5",
72
72
  bodyCellNestedExpandIconWrapper: "",
73
73
  bodyCellNestedExpandIcon: {
74
- component: "{UIcon}",
74
+ base: "{UIcon}",
75
75
  wrapper: "rounded-sm",
76
76
  container: "bg-gray-200",
77
77
  },
78
78
  bodyCellNestedCollapseIcon: {
79
- component: "{UIcon}",
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
- component: "{UBadge}",
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
- component: "{UDropdownList}",
16
- base: "w-fit",
14
+ base: "{UDropdownList} w-fit",
17
15
  variants: {
18
16
  yPosition: {
19
17
  top: "bottom-6 mb-6",
@@ -1,7 +1,7 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: "relative inline-block",
3
3
  dropdownButton: {
4
- component: "{UButton}",
4
+ base: "{UButton}",
5
5
  variants: {
6
6
  opened: {
7
7
  true: "group ring-dynamic ring-offset-dynamic ring-{color}-700/15",
@@ -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
- component: "{URadio}",
16
+ base: "{URadio}",
17
17
  radio: "checked:text-white !border-gray-300",
18
18
  },
19
19
  colorPickerRadio: {
20
- component: "{URadio}",
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
- component: "{UInput}",
6
- wrapper: "ring-dynamic rounded-dynamic ring-offset-dynamic ring-brand-700/15 border-brand-500 hover:border-brand-500",
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
- component: "{UCalendar}",
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
- component: "{UInput}",
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-500/15",
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
- component: "{UInput}",
87
+ base: "{UInput}",
91
88
  inputLabel: {
92
- component: "{ULabel}",
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
- component: "{UInput}",
100
+ base: "{UInput}",
104
101
  inputLabel: {
105
- component: "{ULabel}",
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
- component: "{UCalendar}",
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",
@@ -52,7 +52,7 @@ export default /*tw*/ {
52
52
  fileList: "{UFiles} w-full",
53
53
  buttons: "flex gap-3 items-center",
54
54
  chooseFileButton: {
55
- component: "{UButton}",
55
+ base: "{UButton}",
56
56
  variants: {
57
57
  disabled: {
58
58
  true: "opacity-75",
@@ -1,6 +1,6 @@
1
1
  export default /*tw*/ {
2
2
  label: {
3
- component: "{ULabel}",
3
+ base: "{ULabel}",
4
4
  content: "gap-6 items-center",
5
5
  },
6
6
  number: "",
@@ -1,6 +1,6 @@
1
1
  export default /*tw*/ {
2
2
  selectLabel: {
3
- component: "{ULabel}",
3
+ base: "{ULabel}",
4
4
  variants: {
5
5
  opened: {
6
6
  true: "group/active",
@@ -1,7 +1,6 @@
1
1
  export default /*tw*/ {
2
2
  file: {
3
- component: "{ULink}",
4
- base: "flex items-center",
3
+ base: "{ULink} flex items-center",
5
4
  variants: {
6
5
  size: {
7
6
  sm: "gap-0.5",
@@ -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 });
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.564",
4
+ "version": "0.0.566",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",