vueless 0.0.655 → 0.0.657

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.
@@ -95,7 +95,7 @@ export default function useUI<T>(
95
95
 
96
96
  classes = classes.replaceAll(EXTENDS_PATTERN_REG_EXP, "");
97
97
 
98
- return color ? setColor(classes, color) : classes;
98
+ return color && !getNestedComponent(value) ? setColor(classes, color) : classes;
99
99
  });
100
100
  }
101
101
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.655",
3
+ "version": "0.0.657",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -3,7 +3,6 @@ export default /*tw*/ {
3
3
  base: "{UButton} font-normal",
4
4
  defaults: {
5
5
  variant: "thirdary",
6
- color: "brand",
7
6
  },
8
7
  },
9
8
  toggleButtonInactive: "{>toggleButton} text-gray-900",
@@ -3,6 +3,7 @@ import { computed, ref } from "vue";
3
3
 
4
4
  import useUI from "../composables/useUI.ts";
5
5
  import { getDefaults } from "../utils/ui.ts";
6
+ import { hasSlotContent } from "../utils/helper.ts";
6
7
 
7
8
  import defaultConfig from "./config.ts";
8
9
  import { COMPONENT_NAME, PLACEMENT } from "./constants.ts";
@@ -87,8 +88,14 @@ const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Confi
87
88
  </div>
88
89
 
89
90
  <!-- `v-bind` isn't assigned, because the div is system -->
90
- <div v-if="label || error || description">
91
- <label v-if="label" :for="props.for" v-bind="labelAttrs" :data-test="`${dataTest}-label`">
91
+ <div v-if="label || hasSlotContent($slots['label']) || error || description">
92
+ <label
93
+ v-if="label || hasSlotContent($slots['label'])"
94
+ ref="labelRef"
95
+ :for="props.for"
96
+ v-bind="labelAttrs"
97
+ :data-test="`${dataTest}-label`"
98
+ >
92
99
  <!--
93
100
  @slot Use this to add custom content instead of the label.
94
101
  @binding {string} label
@@ -113,7 +120,13 @@ const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Confi
113
120
  </div>
114
121
 
115
122
  <div v-else v-bind="wrapperAttrs">
116
- <label v-if="label" :for="props.for" v-bind="labelAttrs" :data-test="`${dataTest}-label`">
123
+ <label
124
+ v-if="label || hasSlotContent($slots['label'])"
125
+ v-bind="labelAttrs"
126
+ ref="labelRef"
127
+ :for="props.for"
128
+ :data-test="`${dataTest}-label`"
129
+ >
117
130
  <!--
118
131
  @slot Use this to add custom content instead of the label.
119
132
  @binding {string} label
@@ -61,7 +61,7 @@ const slots = useSlots();
61
61
  const elementId = props.id || useId();
62
62
 
63
63
  const textareaRef = ref<HTMLTextAreaElement | null>(null);
64
- const labelComponentRef = ref<{ labelElement: HTMLElement | null } | null>(null);
64
+ const labelComponentRef = ref<InstanceType<typeof ULabel> | null>(null);
65
65
  const leftSlotWrapperRef = ref<HTMLElement | null>(null);
66
66
  const wrapperRef = ref<HTMLElement | null>(null);
67
67
 
@@ -214,7 +214,9 @@ async function findComponentColors(componentName, files, vuelessConfigFiles) {
214
214
  const fileContent = await readFile(file, "utf-8");
215
215
  const isDefaultConfig = isDefaultComponentConfig(file, componentName);
216
216
  const componentRegExp = new RegExp(`<${componentName}[^>]+>`, "g");
217
+ const componentExtendExp = new RegExp(`{${componentName}}`, "g");
217
218
  const matchedComponent = fileContent.match(componentRegExp);
219
+ const matchedExtendComponent = fileContent.match(componentExtendExp);
218
220
 
219
221
  if (!isComponentExists) {
220
222
  isComponentExists = Boolean(matchedComponent);
@@ -228,6 +230,14 @@ async function findComponentColors(componentName, files, vuelessConfigFiles) {
228
230
  });
229
231
  }
230
232
 
233
+ if (matchedExtendComponent) {
234
+ const objectColors = objectColorRegExp.exec(fileContent) || [];
235
+
236
+ objectColors.forEach((color) => {
237
+ if (color) colors.add(color);
238
+ });
239
+ }
240
+
231
241
  /* Collect color from U[Component] */
232
242
  matchedComponent?.forEach((match) => {
233
243
  const [, singleColor] = singleColorRegExp.exec(match) || [];