vueless 0.0.188 → 0.0.189

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.188",
3
+ "version": "0.0.189",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -212,6 +212,23 @@ export default class UIService {
212
212
  setColor(classes, color) {
213
213
  return classes?.replaceAll("{color}", color);
214
214
  }
215
+
216
+ /**
217
+ Check is config key not contains classes or CVA config object.
218
+ @param { String } key
219
+ @returns { Boolean }
220
+ */
221
+ isSystemKey(key) {
222
+ return (
223
+ key === "i18n" ||
224
+ key === "strategy" ||
225
+ key === "safelist" ||
226
+ key === "safelistColors" ||
227
+ key === "defaultVariants" ||
228
+ key.includes("iconName") ||
229
+ key.includes("IconName")
230
+ );
231
+ }
215
232
  }
216
233
 
217
234
  export const {
@@ -222,6 +239,7 @@ export const {
222
239
  setFavicon,
223
240
  setBrandColor,
224
241
  convertHexInRgb,
242
+ isSystemKey,
225
243
  isMac,
226
244
  isPWA,
227
245
  isIOS,
@@ -1,60 +1,37 @@
1
1
  import { computed } from "vue";
2
2
  import useUI from "../../composable.ui";
3
- import { cva } from "../../service.ui";
4
-
3
+ import { cva, isSystemKey } from "../../service.ui";
5
4
  import defaultConfig from "../configs/default.config";
6
5
 
6
+ const componentKeys = ["icon", "divider"];
7
+
7
8
  export function useAttrs(props, { isOpened }) {
8
9
  const { config, getAttrs } = useUI(defaultConfig, () => props.config);
9
- const { wrapper, title, description } = config.value;
10
-
11
- const cvaWrapper = cva({
12
- base: wrapper.base,
13
- variants: wrapper.variants,
14
- compoundVariants: wrapper.compoundVariants,
15
- });
16
-
17
- const cvaTitle = cva({
18
- base: title.base,
19
- variants: title.variants,
20
- compoundVariants: title.compoundVariants,
21
- });
22
-
23
- const cvaDescription = cva({
24
- base: description.base,
25
- variants: description.variants,
26
- compoundVariants: description.compoundVariants,
27
- });
28
-
29
- const wrapperClasses = computed(() => cvaWrapper({ size: props.size }));
30
-
31
- const titleClasses = computed(() =>
32
- cvaTitle({
33
- size: props.size,
34
- }),
35
- );
36
-
37
- const descriptionClasses = computed(() =>
38
- cvaDescription({
39
- size: props.size,
40
- isOpened: isOpened.value,
41
- }),
42
- );
43
-
44
- const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses });
45
- const bodyAttrs = getAttrs("body");
46
- const titleAttrs = getAttrs("title", { classes: titleClasses });
47
- const descriptionAttrs = getAttrs("description", { classes: descriptionClasses });
48
- const iconAttrs = getAttrs("icon", { isComponent: true });
49
- const dividerAttrs = getAttrs("divider", { isComponent: true });
10
+ const attrs = {};
11
+
12
+ // New approach of defining attrs dynamically (need to test).
13
+ for (const key in defaultConfig) {
14
+ if (isSystemKey(key)) continue;
15
+
16
+ let classes = "";
17
+ let value = config.value[key];
18
+
19
+ if (value.variants || value.compoundVariants) {
20
+ const getCVA = cva(value);
21
+
22
+ classes = computed(() =>
23
+ getCVA({
24
+ ...props,
25
+ isOpened: isOpened.value,
26
+ }),
27
+ );
28
+ }
29
+
30
+ attrs[`${key}Attrs`] = getAttrs(key, { classes, isComponent: componentKeys.includes(key) });
31
+ }
50
32
 
51
33
  return {
34
+ ...attrs,
52
35
  config,
53
- wrapperAttrs,
54
- descriptionAttrs,
55
- bodyAttrs,
56
- titleAttrs,
57
- iconAttrs,
58
- dividerAttrs,
59
36
  };
60
37
  }
@@ -21,11 +21,11 @@ const DefaultTemplate = (args) => ({
21
21
  },
22
22
  template: `
23
23
  <UAccordion
24
- v-bind="args"
25
24
  name="Excellence"
26
25
  title="Excellence by necessity"
27
26
  description="As creators and maintainers of the technologies you are using,
28
27
  our services are here to showcase the full power of our softwares."
28
+ v-bind="args"
29
29
  />
30
30
  <UAccordion
31
31
  v-bind="args"
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.188",
4
+ "version": "0.0.189",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",